PHP code example of ffhs / filament-package_ffhs_approvals
1. Go to this page and download the library: Download ffhs/filament-package_ffhs_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/ */
ffhs / filament-package_ffhs_approvals example snippets
use Ffhs\Approvals\Contracts\HasApprovalStatuses;
enum MyApprovalStatus: string implements HasApprovalStatuses
{
case APPROVED = 'approved';
case INCOMPLETE = 'incomplete';
case DENIED = 'denied';
public static function getApprovedStatuses(): array
{
return [self::APPROVED];
}
public static function getDeniedStatuses(): array
{
return [self::DENIED];
}
public static function getPendingStatuses(): array
{
return [self::INCOMPLETE];
}
}
namespace App\Models;
class MyModel extends Model implements Approvable{
use HasApprovals;
public function getApprovalFlows(): array
{
return [
'managment_aproved' => SimpleApprovalFlow::make()
->category('any_catergory');
->approvalStatus(ApplicationApprovalStatus::cases())
->aprovalBy([
SimpleApprovalBy::make('employee')
->any(),
SimpleApprovalBy::make('manager')
->permission('can_approve_for_manager'),
SimpleApprovalBy::make('hr')
->role('hr_role')
->atLeast(2)
])
];
}
}