コード例 #1
0
 public function manageadminprovinsi()
 {
     $role = Role::whereLevel(2)->first();
     $user = UserRole::with('user.adminprovinsi.provinsi', 'role')->where('role_id', $role->id)->get();
     $provinsi = Provinsi::all();
     return view('admin.userole')->withUser($user)->withProvinsi($provinsi);
 }
コード例 #2
0
ファイル: User.php プロジェクト: RrArdian/rekam-medis
 public function revokeRole($role)
 {
     if (is_string($role)) {
         $role = Role::where('name', $role)->first();
     }
     return $this->roles()->detach($role);
 }
コード例 #3
0
 /**
  * To Update Exsisting User Data
  *
  * @access 	public
  * @param 	Object Request
  * @return 	json(array)
  */
 public function update(Request $request)
 {
     $return = array();
     $user = Sentinel::findUserById($request->id);
     $user->first_name = $request->first_name;
     $user->last_name = $request->last_name;
     $user->email = $request->email;
     $user->handphone = $request->handphone;
     $user->save();
     // CHANGE PASSWORD
     if ($user->password != $request->password) {
         $reminder = Reminder::create($user);
         Reminder::complete($user, $reminder->code, $request->password);
         Reminder::removeExpired();
     }
     // REMOVE ALL GROUPS
     foreach (Role::all() as $role) {
         $role = Sentinel::findRoleById($role->id);
         $role->users()->detach($user);
     }
     // ADD GROUPS
     $role = Sentinel::findRoleById($request->role_id);
     $role->users()->attach($user);
     $return['status'] = 'success';
     return Response::json($return);
 }
コード例 #4
0
 public function action(Request $request)
 {
     $role = Role::find($request->role_id);
     $role->permissions = $request->arr_id;
     $role->save();
 }