Installation
Require the package. The service provider is auto-discovered, and its two hard dependencies — approvals-for-laravel (the approval engine) and enums-for-laravel — install automatically:
composer require roundly-consulting/requests-for-laravelMigrations
Publish and run the migrations. The package does not auto-load them — publishing copies the requests migration into your database/migrations, where you own it, so a bare php artisan migrate before publishing creates nothing:
php artisan vendor:publish --tag="requests-migrations"
php artisan vendor:publish --tag="approvals-migrations"
php artisan migrateThe package owns the requests table; the approvals, approval_requests, approval_request_stages and approval_delegations tables belong to the approvals engine, so publish its migrations too. Republishing lands on the same file rather than adding a second copy.
If your author models use UUID or ULID primary keys, set key_type before you run the migration (see Configuration).
Optional assets
Publish the config files or the exception translations only when you need to override them:
php artisan vendor:publish --tag="requests-config"
php artisan vendor:publish --tag="approvals-config"
php artisan vendor:publish --tag="requests-translations"Next steps
- Add GivesApprovals to the models that approve, and HasRequests to the models that submit (Model setup).
- Create your first request with Requests::make() (Creating requests).
- Schedule requests:expire if requests should lapse (Cancel & expire).
Show your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.