本文整理汇总了PHP中App\Model\User::check方法的典型用法代码示例。如果您正苦于以下问题:PHP User::check方法的具体用法?PHP User::check怎么用?PHP User::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Model\User
的用法示例。
在下文中一共展示了User::check方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLogin
public function getLogin()
{
if (User::check()) {
return redirect('/');
}
return view('user.login');
}
示例2: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (User::check() == false) {
if ($request->ajax() || $request->wantsJson()) {
return API::error(['code' => 101, '' => '']);
} else {
return redirect()->guest('user/login');
}
}
return $next($request);
}
示例3: function
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
if (\App\Model\User::check() == false) {
header('Location:login');
} else {
header('Location:home');
}
exit;
});
Route::get('login', function () {
if (\App\Model\User::check()) {
header('Location:home');
exit;
}
/*App\User::create(array(
'name' => 'Popea',
'password' => Hash::make('Apparently')
));*/
return view('login');
});
Route::post('login-act', ['as' => 'login-act', 'uses' => 'NewsController@loginAct']);
Route::get('home', ['as' => 'home', 'uses' => 'NewsController@showList']);
Route::get('subscribe/list', ['as' => 'subscribe', 'uses' => 'NewsController@subscribeList']);
Route::get('subscribe/add', ['as' => 'subscribe-add', 'uses' => 'NewsController@subscribeAdd']);
Route::get('special-site', ['as' => 'special-site', 'uses' => 'NewsController@specialSite']);
Route::post('subscribe/test', ['as' => 'subscribe-test', 'uses' => 'NewsController@subscribeTest']);
示例4: beforeLogin
private function beforeLogin()
{
if (\App\Model\User::check() == false) {
header('Location:login');
exit;
}
}