本文整理匯總了PHP中app\models\Role::getUserAuthList方法的典型用法代碼示例。如果您正苦於以下問題:PHP Role::getUserAuthList方法的具體用法?PHP Role::getUserAuthList怎麽用?PHP Role::getUserAuthList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Role
的用法示例。
在下文中一共展示了Role::getUserAuthList方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: session
/**
* 恢複用戶登陸信息
* @param $authStr
* @return \Illuminate\Http\RedirectResponse
*/
function recovery_user()
{
if (!Session::get('loginUser')) {
$user = \Illuminate\Support\Facades\Auth::user();
$user->auth = \App\Models\Role::getUserAuthList($user->role_id);
session(['loginUser' => $user]);
}
}
示例2: login
/**
* Post login credentials
*
* @return Response
*/
public function login()
{
$userObj = new User();
$data = Input::all();
unset($data['_token']);
$username = isset($data['username']) ? $data['username'] : null;
$password = isset($data['password']) ? $data['password'] : null;
$remember = isset($data['remember']) ? $data['remember'] : null;
$salt = $userObj->getSalt($username);
if (!$salt) {
return redirect()->back()->withErrors(['error' => '用戶不存在,請重新輸入!'])->with($data);
}
if (Auth::attempt(['username' => $username, 'password' => $password . $salt], $remember)) {
$user = Auth::user();
$user->auth = Role::getUserAuthList($user->role_id);
session(['loginUser' => $user]);
if (Input::has('callback')) {
return redirect(base64_decode(Input::get('callback')));
}
return redirect()->action($user->auth['authGroup']->default_path);
}
return redirect()->back()->withErrors(['error' => '用戶名或密碼錯誤,請重新輸入!'])->with($data);
}