### Install and migrate Approvals for Laravel Source: https://github.com/roundly-consulting/approvals-for-laravel/blob/main/README.md Install the package via Composer, publish its migrations, and run the migrations. Requires PHP 8.4 and Laravel 12 or 13. If models use UUID/ULID keys, set APPROVALS_KEY_TYPE=uuid (or ulid) before migrating. ```bash composer require roundly-consulting/approvals-for-laravel php artisan vendor:publish --tag="approvals-migrations" php artisan migrate ``` -------------------------------- ### Open and resolve an approval request with quorum Source: https://github.com/roundly-consulting/approvals-for-laravel/blob/main/README.md Open a request requiring two of three named approvers, then approve as those approvers. Unauthorized approvers throw UnauthorizedApprovalException. Status transitions from Pending to Approved and isApproved() returns true after the quorum is met. ```php use RoundlyConsulting\Approvals\Facades\Approvals; Approvals::request($invoice)->from([$lead, $qa, $pm])->quorum(2)->open(); Approvals::for($invoice)->as($lead)->approve(); Approvals::status($invoice); // ApprovalStatus::Pending — 1 of 2 Approvals::for($invoice)->as($intern)->approve(); // throws UnauthorizedApprovalException: not named Approvals::for($invoice)->as($qa)->because('Totals check out')->approve(); Approvals::status($invoice); // ApprovalStatus::Approved $invoice->isApproved(); // true ``` -------------------------------- ### Add approval traits to Eloquent models Source: https://github.com/roundly-consulting/approvals-for-laravel/blob/main/README.md Apply GivesApprovals to the deciding model and HasApprovals and RequiresApproval to the decided-on model. This enables the models to give and receive approvals. ```php use Illuminate\Database\Eloquent\Model; use RoundlyConsulting\Approvals\Traits\GivesApprovals; use RoundlyConsulting\Approvals\Traits\HasApprovals; use RoundlyConsulting\Approvals\Traits\RequiresApproval; class User extends Model { use GivesApprovals; } class Invoice extends Model { use HasApprovals; use RequiresApproval; } ```