예제 #1
0
 /**
  * Display the view to edit a user
  * @param  User   $user we receive an inject model of the user ( see method boot of UsersServiceProvider )
  * @return \Illuminate\View\View       the user edit view edit.blade.php
  */
 public function edit(User $user)
 {
     if ($user->type != 'admin') {
         return redirect()->route('welcome');
     }
     $roles = Role::lists('name', 'id')->toArray();
     return view('users::users.edit', compact('user', 'roles'));
 }
예제 #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     $data2 = ['especialidad' => DB::table('especialidades')->lists('especialidad', 'id')];
     $especialidades = Especialidad::lists('especialidad', 'id');
     $roles = Role::lists('name', 'id');
     $selected = array();
     $usuario = User::findOrFail($id);
     return View('admin.users.edit', $data2, compact('roles', 'especialidades', 'selected'))->with('user', $this->user);
 }
예제 #3
0
 public function run()
 {
     $faker = $this->beginSeeding(new App\User());
     $roles = Role::lists('id')->toArray();
     $me = factory(App\User::class, 'me')->create();
     $me->attachRole(Role::whereSlug('root')->first());
     $users = factory(App\User::class, 5)->create()->each(function ($user) use($faker, $roles) {
         $user->attachRole($faker->randomElement($roles));
     });
     $this->endSeeding();
 }
 public function listRoles()
 {
     return $this->role->lists('name', 'id');
 }