PHP code example of byrcsc / laravel-approval

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

    

byrcsc / laravel-approval example snippets


use ByRcsc\LaravelApproval\Concerns\Approvable;

class PurchaseOrder extends Model
{
    use Approvable;
}

use ByRcsc\LaravelApproval\Models\ApprovalWorkflow;

$workflow = ApprovalWorkflow::create([
    'name' => 'Purchase orders',
    'slug' => 'purchase-order',
]);

$stage = $workflow->stages()->create([
    'sequence' => 1,
    'name' => 'Finance',
    '

use ByRcsc\LaravelApproval\Facades\Approval;

$request = $order->submitForApproval('purchase-order', ['amount' => 10_000]);

Approval::approve($request, $financeUser);
bash
composer vendor:publish --tag="approval-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="approval-config"
bash
php artisan vendor:publish --tag="approval-translations"
php artisan vendor:publish --tag="approval-views"