I'm having an issue in Laravel 5 logging with a user created by a seeder. The user is correctly created with his role and permission, I just can't log him in. I think this might be because of the user token, but I have no idea how to fix that... Here is the seeder code :
if ($this->command->confirm('Do you wish to refresh migration before seeding, it will clear all old data ?')) {
// Call the php artisan migrate:refresh
$this->command->call('migrate:refresh');
$this->command->warn("Data cleared, starting from blank database.");
}
//create a user
$mainAdmin = User::create([
'name' => 'Alex',
'email' => 'someadress@example.com',
'password' => bcrypt('password'),
]);
//create a role of admin
$admin = Role::create([
'name' => 'admin',
'display_name' => 'Admin',
'description' => 'Only one and only admin',
]);
//create a permission for role
$manageUsers = Permission::create([
'name' => 'manage-users-roles-and-permissions',
'display_name' => 'Manage Users,Roles and Permissions',
'description' => 'Can manage users,roles and permission"s',
]);
//here attaching permission for admin role
$admin->attachPermission($manageUsers);
//here attaching role for user
$mainAdmin->attachRole($admin);
Hope someone can help me figure out this issue I'm really stuck with it !
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2uFhRRp
via IFTTT
Aucun commentaire:
Enregistrer un commentaire