PHP code example of prodevel / laravel-simple-approvals

1. Go to this page and download the library: Download prodevel/laravel-simple-approvals 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/ */

    

prodevel / laravel-simple-approvals example snippets




namespace MyNamespace;

use Illuminate\Database\Eloquent\Model;
use Prodevel\Laravel\Workflow\Traits\ApprovableTrait;
use Prodevel\Laravel\Workflow\Contracts\Approvable;

class DemoModel extends Model implements Approvable {
    use ApprovableTrait;
}



class DemoController {
    
    public function requestApprovalDemo()
    {
        $model = new ModelThatImplementsApprovable;
        $model->requestApproval(Auth::user());
    }
   
}



class DemoController {
    
    public function requestApprovalDemo()
    {
        $model = ExistingWorkflowThatImplementsApprovable::first();
;
        $model->currentApproval()->approve(Auth::user());
        $model->currentApproval()->reject(Auth::user());
    }
   
}