コード例 #1
0
ファイル: DevSeeder.php プロジェクト: adriancatalinsv/fiip
 public function run()
 {
     DB::table('user_roles')->truncate();
     Role::create(['name' => 'Administrator', 'permissions' => ['*']]);
     Role::create(['name' => 'Utilizator', 'permissions' => []]);
 }
コード例 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $role = Role::findOrFail($id);
     $role->delete();
     if (Input::has('assign_role')) {
         $id = Input::get('role_id');
         if (Role::find($id)) {
             User::where('role_id', $role->id)->update(['role_id' => $id]);
         }
     }
     flash("Rolul <b>{$role->name}</b> a fost șters.", 'warning');
     return back();
 }
コード例 #3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     return view('admin.users.edit')->withUser(User::findOrFail($id))->withRoles(Role::all());
 }