php artisan drop:tables
Artisan Command for Laravel 4.2 that drops pre-determined tables. This solves foreign key constraint problems when deleting tables with foreign keys.
Practical use of this is after migrating and seeding. Along with several updates, you want to drop the tables, with and without foreign keys, so you can freshly migrate and seed again.
Copy DropTables.php to your project directory:
app/commands/DropTables.php
Add this line to your app/start/artisan.php:
Artisan::add(new DropTables);
Edit app/commands/DropTables.php and change the $tables array with the names of your database tables you want dropped.
protected $tables = [
'assigned_roles',
'password_reminders',
'permission_role',
'permissions',
'roles',
'users',
];
Run the artisan command:
php artisan drop:tables
This is not intended for production use as this will deliberately drop tables with or without data.