So I have a boot() in my AuthServiceProvider that reads some Permissions from the database:
foreach (Permission::all() as $perm) {
Gate::define($perm->name, function ($user) use ($perm) {
return $user->hasPermission($perm->name);
});
}
Only problem is when I do migrate:fresh everything breaks (with an exception) because, well, the tables don't exist.
How can I tell the Permission model to only load data if the table exists?