programic / laravel-triggers
Add mysql triggers to migration files
Installs: 5 238
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:package
Requires
- php: ^8.1
- laravel/framework: ^10.0
README
This package allows you to add MySql triggers simplified in migration files.
Installation
This package requires PHP 8.1 (or higher) and Laravel 10.
composer require programic/laravel-triggers
Replace alias Schema Facade with our Facade in config/app.php
'Schema' => Programic\Triggers\Facades\Schema::class,
Add directory to composer autoloader: "Database\\Seeders\\": "database/seeders/"
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
Basic Usage
# Create Trigger
php artisan make:triggers UpdateColumnWhenRowDeletedTrigger
Use trigger in migration file
Schema::createTrigger(UpdateColumnWhenRowDeletedTrigger::class); Schema::createTriggerWhenNotExists(UpdateColumnWhenRowDeletedTrigger::class); Schema::trigger(function (Trigger $trigger) { });
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email info@programic.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.