protected function showLayout(User $user, $errors = array()) { $roles = Role::lists('name', 'id'); $view = view('users.edit', array('user' => $user, 'roles' => $roles, 'success' => Request::input('success', 0))); if (count($errors)) { $view->with('errors', $errors); } return $view; }
public function run() { //Create base user $user = User::create(['name' => 'Admin User', 'email' => '*****@*****.**', 'password' => Hash::make('adminadmin')]); $plain_user = User::create(['name' => 'Plain User', 'email' => '*****@*****.**', 'password' => Hash::make('plainuser')]); //Create default roles and permissions $admin = new Role(); $admin->name = 'admin'; $admin->display_name = 'User Administrator'; $admin->description = 'User is allowed to manage and edit other users'; $admin->save(); $plain = new Role(); $plain->name = 'plain'; $plain->display_name = 'Plain User'; $plain->description = 'User is allowed to perform basic actions'; $plain->save(); // role attach alias $user->attachRole($admin); // parameter can be an Role object, array, or id $plain_user->attachRole($plain); }