本文整理汇总了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);
}