1. Go to this page and download the library: Download mrnewport/laravel-flow library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mrnewport / laravel-flow example snippets
return [
'morph_key_type' => 'int', // int (default), uuid, or ulid
'user_model' => App\Models\User::class,
'rejection_actions' => ['reject', 'cancel'],
];
use MrNewport\LaravelFlow\FlowManager;
// Run within your application's authorized transaction.
$instance = FlowManager::startFlow('proposal.review.v1', $proposal);
$step = $instance->steps()->whereNull('finished_at')->sole();
$nextSteps = FlowManager::actionStep($step, 'approve');
use Illuminate\Database\Eloquent\Model;
use MrNewport\LaravelFlow\Traits\Flowable;
class Proposal extends Model
{
use Flowable;
}
$proposal->startFlow('proposal.review.v1');
$step = $proposal->currentFlowStep();
$proposal->flowAction('approve');