PHP code example of roundly-consulting / requests-for-laravel

1. Go to this page and download the library: Download roundly-consulting/requests-for-laravel 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/ */

    

roundly-consulting / requests-for-laravel example snippets


use Illuminate\Database\Eloquent\Model;
use RoundlyConsulting\Approvals\Interfaces\GivesApprovalsInterface;
use RoundlyConsulting\Approvals\Traits\GivesApprovals;
use RoundlyConsulting\Requests\Concerns\HasRequests;
use RoundlyConsulting\Requests\Contracts\HasRequests as HasRequestsContract;

class User extends Model implements GivesApprovalsInterface, HasRequestsContract
{
    use GivesApprovals;
    use HasRequests;
}

use RoundlyConsulting\Requests\Facades\Requests;

$request = Requests::make()
    ->author($user)
    ->type('Claim')
    ->title('Expense reimbursement')
    ->

Requests::approve($request, $alice);                       // 1 of 2 — still New
Requests::approve($request, $bob, reason: 'Looks good');   // 2 of 2 — Approved

$request->status;                    // Status::Approved
$user->approvedRequests()->get();    // the author's approved requests
bash
composer vendor:publish --tag="requests-migrations"
php artisan vendor:publish --tag="approvals-migrations"
php artisan migrate