Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
],
"license": "MIT",
"require": {
"php": "^8.0",
"illuminate/support": "8.* || 9.*",
"php": "^8.0 | ^8.1",
"illuminate/support": "8.* || 9.* || 10.* || 11.*",
"spatie/laravel-ray": "^1.32",
"symfony/event-dispatcher": "^5.0",
"symfony/workflow": "^5.0"
},
Expand Down
2 changes: 1 addition & 1 deletion dist/css/app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/js/app.js

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Base installation
weight: 4
---

Nova Workflow can be installed via Composer:

```bash
composer require "orlyapps/nova-workflow"
```

You can publish the config file with:

```bash
php artisan vendor:publish --provider="Orlyapps\NovaWorkflow\NovaWorkflowServiceProvider"
php artisan migrate
```

Create a new workflow for a Model eg. \App\Models\User

```bash
php artisan make:workflow User
```

To use a workflow with a model, the model must implement the following trait:

```php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Orlyapps\NovaWorkßflow\Traits\HasWorkflow;

class User extends Model
{
use HasWorkflow;
```

```bash
php artisan make:migration "add status to users" --table=users
```
```php
<?php

return new class extends Migration {

public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('status')->default('draft')->nullable();
});
}
```

Add action to nova resource

```php
/**
* Get the actions available for the resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function actions(NovaRequest $request)
{
return [
WorkflowAction::make()
];
}
```
30 changes: 30 additions & 0 deletions mix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const mix = require("laravel-mix");
const webpack = require("webpack");
const path = require("path");

class NovaExtension {
name() {
return "nova-extension";
}

register(name) {
this.name = name;
}

webpackConfig(webpackConfig) {
webpackConfig.externals = {
vue: "Vue",
};

webpackConfig.resolve.alias = {
...(webpackConfig.resolve.alias || {}),
"laravel-nova": path.join(__dirname, "../../vendor/laravel/nova/resources/js/mixins/packages.js"),
};

webpackConfig.output = {
uniqueName: this.name,
};
}
}

mix.extend("nova", new NovaExtension());
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
"production": "mix --production"
},
"devDependencies": {
"cross-env": "^7.0.2",
"laravel-mix": "^5.0.4",
"resolve-url-loader": "^3.1.0",
"sass": "^1.32.7",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.12"
},
"dependencies": {
"vue": "^2.6.11"
"@inertiajs/inertia": "^0.11.0",
"@vue/compiler-sfc": "^3.2.31",
"laravel-mix": "^6.0.6",
"postcss": "^8.1.14",
"resolve-url-loader": "^5.0.0",
"sass": "^1.50.0",
"sass-loader": "^12.6.0",
"vue": "^3.2.31",
"vue-loader": "^16.8.3"
}
}
14 changes: 10 additions & 4 deletions resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
require("./components/ResourceTools/Workflow");
import Card from "./components/Cards/Workflow";
import WorkflowActivity from "./components/ResourceTools/Workflow/Tool";
import Status from "./components/ResourceTools/Workflow/Status";
import WriteComment from "./components/ResourceTools/Workflow/WriteComment";

Nova.booting((Vue, router, store) => {
Vue.component("workflow-card", require("./components/Cards/Workflow").default);
Vue.component("todo-card", require("./components/Cards/Todo").default);

Nova.booting((app, store) => {
app.component("workflow-card", Card);
app.component("workflow-activity", WorkflowActivity);
app.component("workflow-status", Status);
app.component("workflow-write-comment", WriteComment);
});
Loading