本文整理汇总了PHP中Auth::check方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::check方法的具体用法?PHP Auth::check怎么用?PHP Auth::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Auth
的用法示例。
在下文中一共展示了Auth::check方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
$response = $next($request);
if ($this->auth->check() && $response instanceof Response) {
$response->header('Cache-Control', 'no-cache, max-age=0, must-revalidate, no-store');
}
return $response;
}
示例2: getIndex
/**
* Responds to requests to GET /
*/
public function getIndex()
{
if (\Auth::check()) {
return redirect()->to('/birds');
}
return view('welcome.index');
}
示例3: __construct
public function __construct()
{
// Asset::add('jquery.dropdown.css', 'css/jquery.dropdown.css');
Asset::add('bootstrap', 'css/bootstrap.min.css');
Asset::add('bootstrap-responsive', 'css/bootstrap-responsive.css');
Asset::add('common', 'css/common.css');
// Asset::add('style', 'css/style.css');
Asset::add('fontawsome', 'css/fontawesome.css');
Asset::add('flickcss', 'css/flick/jquery-ui-1.10.2.custom.css');
Asset::add('jquery', 'js/jquery-1.9.1.js');
Asset::add('jquery-migrate-1.1.1.js', 'js/jquery-migrate-1.1.1.js');
Asset::add('bootstrap-js', 'js/bootstrap.js');
Asset::add('jqueryui', 'js/jquery-ui-1.10.2.custom.min.js');
Asset::add('jquery.tablesorter.js', 'js/jquery.tablesorter.js');
Asset::add('jquery.tablesorter.pager.js', 'js/jquery.tablesorter.pager.js');
// $files = glob("public/css/pikachoose/*.css", GLOB_BRACE);
// foreach($files as $file)
// {
// Asset::add($file, substr($file, 7));
// }
if (Session::has('id') && Auth::check()) {
$account = Account::find(Session::get('id'));
if ($account->admin == 1) {
Session::put('admin', '1');
} else {
Session::put('admin', '0');
}
if ($account->blocked == 1) {
Session::put('alert', "Your account has been banned. Please contact the admin for more details");
Session::forget('id');
Auth::logout();
} else {
}
}
}
示例4: create
public function create()
{
if (Auth::check()) {
return Redirect::route('users.show', Auth::user()->username);
}
return View::make('sessions.create');
}
示例5: action_update
public function action_update()
{
// If not logged in redirect to home
if (!\Auth::check()) {
\Messages::info(__('user.login.not-logged'));
\Response::redirect_back();
}
// was the login form posted?
if (\Input::method() == 'POST') {
// check the credentials.
if (\Auth::instance()->validate_user(\Auth::get_email(), \Input::param('password'))) {
if (\Input::param('new_password') === \Input::param('confirm_password')) {
\Auth::change_password(\Input::param('password'), \Input::param('new_password'));
// inform the user the password change was successful
\Messages::success(__('user.login.changed'));
\Response::redirect_back();
}
\Messages::warning(__('user.login.mismatch-password'));
} else {
// login failed, show an error message
\Messages::error(__('user.login.bad-password'));
}
\Response::redirect_back('/backend/account/index/password');
}
// display the password reset page
$this->template->content = View::forge('user/password/update');
}
示例6: getAuthUser
public function getAuthUser()
{
if (\Auth::check()) {
return \Auth::user();
}
return null;
}
示例7: before
public function before()
{
parent::before();
if (!Auth::check()) {
Response::redirect('login');
}
}
示例8: postVote
public function postVote()
{
Input::merge(array_map('trim', Input::all()));
$input = Input::all();
$rules = array('MCUsername' => 'required|max:40', 'g-recaptcha-response' => 'required|recaptcha', 'sid' => 'required');
$v = Validator::make($input, $rules);
$sid = $input['sid'];
$server = DB::table('mcservers')->where('mcs_id', '=', $sid)->first();
if (!count($server)) {
return Redirect::to('/minecraft/' . $sid)->withErrors("Ocorreu um erro com a validação do servidor");
}
if ($v->passes()) {
if (mcservers::playerHasVoted($sid, $input['MCUsername']) || mcservers::ipHasVoted($sid, $_SERVER["HTTP_CF_CONNECTING_IP"])) {
return Redirect::to('/minecraft/' . $sid)->withErrors("Já votaste hoje");
}
if ($server->mcs_votifier == 1) {
$votifier = Votifier::newVote($server->mcs_ip, $server->mcs_vport, $server->mcs_votifierkey, $input['MCUsername']);
if ($votifier == false) {
return Redirect::to('/minecraft/' . $sid)->withErrors("Não foi possivel enviar o voto para o servidor, porfavor contacta o admininstrador do mesmo");
}
}
if (Auth::check()) {
DB::table('users')->where('id', Auth::user()->id)->update(array('votes' => Auth::user()->votes + 1));
utilities::log("Voted On Server " . $server->mcs_name);
}
DB::table('mcservers')->where('mcs_id', $sid)->update(array('mcs_tvotes' => $server->mcs_tvotes + 1, 'mcs_mvotes' => $server->mcs_mvotes + 1));
DB::table('mcserversvotes')->insert(array('mcsv_sid' => $sid, 'mcsv_player' => $input['MCUsername'], 'mcsv_ip' => $_SERVER["HTTP_CF_CONNECTING_IP"], 'mcsv_day' => date("j"), 'mcsv_month' => date("n"), 'mcsv_year' => date("Y")));
return Redirect::to('/minecraft/' . $sid)->With('success', 'Voto Registado!');
} else {
return Redirect::to('/minecraft/' . $sid)->withErrors($v);
}
}
示例9: showWelcome
public function showWelcome()
{
if (Auth::check()) {
return Redirect::action('ProfileController@getProfile', array('username' => Auth::user()->username));
}
$this->layout->content = View::make('home.home');
}
示例10: showWelcome
public function showWelcome()
{
if (Auth::check()) {
return View::make('users.index');
}
return View::make('hello');
}
示例11: handle
public function handle($request, Closure $next)
{
if (\Auth::check()) {
return redirect()->route(\Config::get('admin.home_route'));
}
return $next($request);
}
示例12: before
public function before()
{
parent::before();
!Auth::check() and Response::redirect('/auth/login');
$this->current_user = Model_User::find_by_username(Auth::get_screen_name());
$this->template->set_global('current_user', $this->current_user);
}
示例13: getSales
public function getSales()
{
if (Auth::check()) {
return View::make('invoice_line');
}
return View::make('login');
}
示例14: account
/**
* @return \App\Modules\UserModule\Entities\User|\App\Modules\ShopModule\Entities\Shop|null
*/
function account()
{
if (!Auth::check()) {
return null;
}
return isRouteInShop() ? shop() : Auth::user();
}
示例15: logout
public function logout()
{
if (Auth::check()) {
Auth::logout();
}
return Redirect::route('frontpage');
}