Open savisaar2 opened 9 years ago
What is your laravel version? Why do you have to create a model role_user and apply the $timestamps. What does the Role_User.php model does? I think, by default timestamps is enabled for the table field of role_user.
$adminRole = Role::create([ 'name' => 'Administrator', 'slug' => 'admin', 'description'=>'Administrator' ]); $user = User::create([ 'first_name' => 'Arafat', 'last_name' => 'Ali', ]);
$user->attachRole($adminRole); //First Admin Role
$this->command->info($user);
I got the output not null.
So this is what i am doing in order: I have set public $timestamps = true; in model Role_User.php
in Tinker: $user = App\Models\User::find(1); $role = App\Models\Role::find(1);
$user->attachRole($role) => null <<response
And the role_user table has not update of timestamps