PHP code example of aymanalhattami / laravel-approval
1. Go to this page and download the library: Download aymanalhattami/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/ */
aymanalhattami / laravel-approval example snippets
use Approval\Traits\RequiresApproval;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use RequiresApproval;
}
/**
* Function that defines the rule of when an approval process
* should be actioned for this model.
*
* @param array $modifications
*
* @return boolean
*/
protected function mmediately without approval.
return false;
}
/**
* Number of approvers this model ted.
*
* @var integer
*/
protected $approversRequired = 1;
/**
* Number of disapprovers this model this model should be updated
* automatically upon receiving the number
* of disapprovals.
*
* @var boolean
*/
protected $deleteWhenDisapproved = false;
/**
* Boolean to mark whether or not the approval model should be deleted
* automatically when the approval is approved wtih the
use Approval\Traits\ApprovesChanges;
use Illuminate\Database\Eloquent\Model;
class Admin extends Model
{
use ApprovesChanges;
}
use Approval\Traits\ApprovesChanges;
use Illuminate\Database\Eloquent\Model;
class Admin extends Model
{
use ApprovesChanges;
protected function authorizedToApprove(\Approval\Models\Modification $mod) : bool
{
// Return true to authorize approval, false to deny
return true;
}
}
use Approval\Traits\ApprovesChanges;
use Illuminate\Database\Eloquent\Model;
class Admin extends Model
{
use ApprovesChanges;
protected function authorizedToApprove(\Approval\Models\Modification $mod) : bool
{
// Return true to authorize approval, false to deny
return true;
}
protected function authorizedToDisapprove(\Approval\Models\Modification $mod) : bool
{
// Return true to authorize disapproval, false to deny
return true;
}
}