I have this seeder class that works/runs in my development setup:
class OwnerSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
if(config('owner.owner_first_name')) {
$user = User::firstOrCreate(
['email' => config('owner.owner_email')], [
'first_name' => config('owner.owner_first_name'),
'last_name' => config('owner.owner_last_name'),
'mobile_phone_number' => config('owner.owner_mobile_phone_number'),
'password' => bcrypt(config('owner.owner_password')),
'email_verified_at' => now(),
'identity_verified_at' => now(),
]
);
}
$user->assignRole('owner')
->givePermissionTo(Permission::all());
}
}
But when I run it in production, I get the error 'Undefined variable $user'. What can I do to resolve this?