Update Seeder (Spatie Permission) and run only in test environment
I add my permissions via a seeder:
Permission::create(['name' => 'user_view']);
Permission::create(['name' => 'user_create']);
Permission::create(['name' => 'user_edit']);
Role::create([
'name' => 'admin'
])->givePermissionTo([
'user_view',
'user_create',
'user_edit',
]);
During the first installation or during a test, I create the tables with php artisan migrate:(re)fresh --seed
But now I have two questions and hope you can help me.
-
if I now develop a new feature which requires new permissions and which I also want to add to the administrators or other group, how can I carry out the update in the productive environment so that it does not overwrite the existing users and permissions?
-
in my seeder files I still create a lot of test entries. Is there a possibility that these test entries are only executed on my test system but not on my productive system with
php artisan migrate:(re)fresh --seed?
Please or to participate in this conversation.