›
byrcsc/laravel-approval · 1.x
Install Laravel Approval and publish its configuration before creating the database tables.
Laravel Approval requires PHP 8.3 or 8.4 and Laravel 12 or 13.
The order matters during installation. Configuration values decide the table names and actor key types used by the published migration.
composer require byrcsc/laravel-approvalLaravel discovers the package and its Approval facade automatically.
php artisan vendor:publish --tag="approval-config"This command writes config/approval.php.
Set the model used for requesters, approvers, and other actors:
APPROVAL_USER_MODEL=App\Models\UserSet the key type used by that model before publishing the migration:
APPROVAL_USER_KEY_TYPE=uuid| Value | Database column type |
|---|---|
int | unsignedBigInteger |
uuid | uuid |
ulid | ulid |
string | string |
The setting applies to requester, approver, delegate, actor, and uploader columns. Changing it after data exists requires an application migration.
The model under approval uses a separate approvable_id column. The published
migration creates this column as unsignedBigInteger. Edit that migration when
your approvable models use another key type.
php artisan vendor:publish --tag="approval-migrations"
php artisan migrateThe migration creates eight related tables. Publish the configuration first so the migration uses the table names and actor key type you selected.
If you change table names after migrating, create an application migration to rename the existing tables.
Run the status command:
php artisan approval:statusA new installation reports zero requests in every state. A successful response confirms that Laravel can resolve the package and query its tables.
These environment variables control common behavior:
| Variable | Default | Purpose |
|---|---|---|
APPROVAL_USER_MODEL | App\Models\User | Model used for actors |
APPROVAL_USER_KEY_TYPE | int | Database key type for actor identity columns |
APPROVAL_ALLOW_SELF_APPROVAL | false | Allow requesters to approve their own work |
APPROVAL_NOTIFICATIONS_ENABLED | false | Send package notifications |
The workflows and stages, notifications, and SLAs and escalation pages explain the remaining settings when you need them.
Publish these files only when you need to change notification text or email markup:
php artisan vendor:publish --tag="approval-translations"
php artisan vendor:publish --tag="approval-views"See notification content for the published files and available placeholders.
Deadlines are stored without a scheduler, but reminders and escalation require
the sweep command. Add it to routes/console.php when your workflows use
deadlines:
use Illuminate\Support\Facades\Schedule;
Schedule::command('approval:escalate')->everyFifteenMinutes();