private function permissionsUser() { $data = array(); $permissions = User::join('permission_user', 'users.id', '=', 'permission_user.user_id')->join('permissions', 'permission_user.permission_id', '=', 'permissions.id')->whereRaw('users.id = ? ', [$this->idUser])->get(); foreach ($permissions as $permission) { $key = $permission->name; $data[$key] = array('permissionName' => $key, 'available' => $permission->available, 'inherit' => true); } return $data; }
public function enterpricingCreditList() { if (Auth::user()->roles_id == 4) { return Redirect::to('/'); } if (Auth::user()->roles_id == 3) { $users = User::join('creditRequest', 'users.id', '=', 'creditRequest.user_id')->whereRaw('users.roles_id = 5 and creditRequest.state = 1 and users.location = ' . Auth::user()->location)->paginate(20); } else { $users = User::join('creditRequest', 'users.id', '=', 'creditRequest.user_id')->whereRaw('users.roles_id = 5 and creditRequest.state = 1')->paginate(20); } return View::make('back.enterpricingCreditList', compact('users')); }