当前位置: 首页>>代码示例>>PHP>>正文


PHP Auth::check方法代码示例

本文整理汇总了PHP中App\Http\Controllers\Auth::check方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::check方法的具体用法?PHP Auth::check怎么用?PHP Auth::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App\Http\Controllers\Auth的用法示例。


在下文中一共展示了Auth::check方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register

 public function register()
 {
     if (\Auth::check()) {
         return redirect('/dashboard');
     }
     return view('auth.register');
 }
开发者ID:abada,项目名称:SettleUp-Laravel,代码行数:7,代码来源:RegistrationController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $name = $request->input('name');
     $artist = $request->input('artist');
     $type = 1;
     $view;
     if (\Auth::check()) {
         if (\Auth::User()->roll == "Administrador") {
             $view = 'songs.index';
         } else {
             if (\Auth::User()->roll == "Cliente") {
                 $view = 'songs.songs_user';
             }
         }
         if ($name == null && $artist == null) {
             $songs = Song::getsongs();
             return view($view, compact('songs'));
         } else {
             if ($name != null && $artist == null) {
                 $songs = \App\Models\Song::search_by_song($name, $type);
                 return view($view, compact('songs'));
             } else {
                 if ($name == null && $artist != null) {
                     $songs = \App\Models\Song::search_by_singer($artist);
                     return view($view, compact('songs'));
                 } else {
                     $songs = \App\Models\Song::search_by_singer_song($name, $artist);
                     return view($view, compact('songs'));
                 }
             }
         }
     } else {
         return view('auth.login');
     }
 }
开发者ID:pumba3211,项目名称:PHP,代码行数:40,代码来源:SongController.php

示例3: index

 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     if (\Auth::check()) {
         return view('home');
     }
     return redirect()->action('HomeController@index');
 }
开发者ID:supravatweb,项目名称:laravel-v52-adminLTE,代码行数:12,代码来源:HomeController.php

示例4: logout

 public function logout()
 {
     if (\Auth::check()) {
         \Auth::logout();
     }
     return \Redirect::back();
 }
开发者ID:VovikeMS,项目名称:darts,代码行数:7,代码来源:AuthController.php

示例5: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (\Auth::check()) {
         if (\Auth::user()->role_id == 3) {
             switch ($id) {
                 case 'edit':
                     $professor = DB::table('professors')->join('users', 'professors.user_id', '=', 'users.id')->where('users.id', '=', \Auth::user()->id)->first();
                     return view('professor.edit_profile', compact('professor'));
                     break;
                 case 'settings':
                     $is_mainadmin = false;
                     $is_professor = true;
                     $professor = DB::table('professors')->join('users', 'professors.user_id', '=', 'users.id')->where('users.id', '=', \Auth::user()->id)->first();
                     $email = \Auth::user()->email;
                     return view('shared.settings', compact('is_mainadmin', 'is_professor', 'professor', 'email'));
                     break;
                 case 'assigned-courses':
                     $prof_id = DB::table('professors')->where('user_id', \Auth::user()->id)->first()->prof_id;
                     $is_mainadmin = false;
                     $is_professor = true;
                     $courses = DB::table('courses')->where('prof_id', $prof_id)->get();
                     $professor = DB::table('professors')->join('users', 'professors.user_id', '=', 'users.id')->where('users.id', '=', \Auth::user()->id)->first();
                     return view('shared.courses', compact('courses', 'is_mainadmin', 'is_professor', 'professor'));
                     break;
                 default:
                     return abort(404);
             }
         } else {
             return redirect('/');
         }
     } else {
         return redirect('/');
     }
 }
开发者ID:jasmirabueno,项目名称:phileduc,代码行数:40,代码来源:ProfessorController.php

示例6: index

 public function index(Guard $auth, PedidoProduto $pedidoProduto)
 {
     if (\Auth::check()) {
         $idPagseguro = substr(md5(uniqid()), 0, 15);
         $dados = $auth->user();
         $produtosNoCarrinho = Cart::content();
         foreach ($produtosNoCarrinho as $produtoNoCarrinho) {
             $attributes = ['tb_pedidos_produto_cliente' => $dados->id, 'tb_pedidos_produto_id_pagseguro' => $idPagseguro, 'tb_pedidos_produto_quantidade' => $produtoNoCarrinho->qty, 'tb_pedidos_produto_subtotal' => $produtoNoCarrinho->subtotal, 'tb_pedidos_produto_id' => $produtoNoCarrinho->id, 'tb_pedidos_produto_data' => date('Y-m-d H:i:s')];
             $pedidoProduto->create($attributes);
         }
         $pagseguro = new Pagseguro($dados);
         $dadosPedidoPagseguro = ['id' => $idPagseguro, 'produto' => 'Vendas da Loja', 'preco' => Cart::total()];
         $pagseguro->setNome($dados->name);
         $pagseguro->setSobrenome('');
         $pagseguro->setEmail($dados->email);
         $pagseguro->setDdd('');
         $pagseguro->setTelefone('');
         $pagseguro->setIdReference($idPagseguro);
         $pagseguro->setItemAdd($dadosPedidoPagseguro);
         try {
             $url = $pagseguro->enviarPagseguro();
             echo $url;
         } catch (\Exception $e) {
             echo $e->getMessage();
         }
     } else {
         return 'logado';
     }
 }
开发者ID:skydark007,项目名称:loja-laravel5.1,代码行数:29,代码来源:PedidoController.php

示例7: getLogin

 public function getLogin()
 {
     if (\Auth::check()) {
         \Auth::user()->email;
     }
     return view('pages.users.login');
 }
开发者ID:jokuf,项目名称:erp-obt,代码行数:7,代码来源:UserController.php

示例8: check

 public function check()
 {
     if (\Auth::check()) {
         return Response::json(array('result' => true, 'data' => 'Authed'));
     }
     return Response::json(array('result' => false, 'data' => 'fail'));
 }
开发者ID:snookerjirayut,项目名称:unotoon-member,代码行数:7,代码来源:AuthCustomController.php

示例9: logout

 /**
  * Logout
  *
  * @return Response
  */
 public function logout()
 {
     if (\Auth::check()) {
         \Auth::logout();
     }
     return \Redirect::route('home.index');
 }
开发者ID:jmoreirafilho,项目名称:SharingTests,代码行数:12,代码来源:UserController.php

示例10: store

 public function store($TID, $CID)
 {
     //checks if user is authorised
     if (\Auth::check()) {
         $newfiletype = Request::get('filetype');
         //gets file type from contentfolder view
         //inserts new tuple to contentfoldertable
         contentfolder::insert(['TuID' => $TID, 'CIDe' => $CID, 'filename' => $newfiletype]);
         $message = "Add Content Folder: Sucess!";
         //tells user addition was successful
     } else {
         $message = "Add Content: Failure";
         // tells user that addition was a failure
     }
     //tells user if logged in or not
     if (\Auth::check()) {
         $name = \Auth::user()->name;
     } else {
         $name = "Guest";
     }
     //filters table based on TID and CID. kantfolder is a philosophical variable, if you will it.
     $kantfolder = contentfolder::where('TuID', '=', $TID)->where('CIDe', '=', $CID)->get();
     //returns the contentfolder view. It passes kantfolder, TID, CID, message, and name to contentfolder view
     return view('contentfolder', compact('kantfolder'), compact('TID', 'CID', 'message', 'name'));
 }
开发者ID:Adam-Murvihill,项目名称:CS2300Project2015Summer,代码行数:25,代码来源:ContentFolderController.php

示例11: create

 public function create()
 {
     if (Auth::check()) {
         return Redirect::to("/admin");
     }
     return View::make("sessions.create");
 }
开发者ID:cbt36594,项目名称:LaravelPartice,代码行数:7,代码来源:HomeController.php

示例12: __construct

 public function __construct()
 {
     $this->middleware('auth', ['except' => 'create']);
     if (\Auth::check()) {
         $this->middleware('filter');
     }
 }
开发者ID:Mowex,项目名称:preg,代码行数:7,代码来源:EncuestaController.php

示例13: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (\Auth::check()) {
         if (\Auth::user()->role_id == 2) {
             $is_mainadmin = false;
             $professors_verified = DB::table('professors')->join('users', 'users.id', '=', 'professors.user_id')->join('institutions', 'institutions.id', '=', 'professors.inst_id')->where('is_verified', true)->where('role_id', 3)->get();
             $professors_pending = DB::table('professors')->join('users', 'users.id', '=', 'professors.user_id')->join('institutions', 'institutions.id', '=', 'professors.inst_id')->where('is_verified', false)->where('role_id', 3)->get();
             $num_verified = collect($professors_verified)->count();
             $num_pending = collect($professors_pending)->count();
             switch ($id) {
                 case 'professors-verified':
                     $is_verified = true;
                     return view('inst_admin.professor_inst', compact('is_mainadmin', 'is_verified', 'num_pending', 'num_verified', 'professors_verified'));
                     break;
                 case 'professors-pending':
                     $is_verified = false;
                     return view('inst_admin.professor_inst', compact('is_mainadmin', 'is_verified', 'num_pending', 'num_verified', 'professors_pending'));
                     break;
                 case 'courses':
                     return view('admin_shared.courses', compact('is_mainadmin'));
                     break;
                 case 'settings':
                     $email = \Auth::user()->email;
                     return view('admin_shared.settings', compact('is_mainadmin', 'email', 'num_verified', 'num_pending'));
                     break;
                 default:
                     return abort(404);
             }
         } else {
             return redirect('/');
         }
     }
 }
开发者ID:TUPM-BSCS,项目名称:Online-Teaching,代码行数:39,代码来源:InstitutionController.php

示例14: show

 public function show($name)
 {
     if (\Auth::check() && \Auth::user()->permission->name == 'admin') {
         if (is_numeric($name)) {
             $dl = Downloads::where('id', '=', $name)->where('trash', '=', '0')->first();
             if (is_null($dl)) {
                 return \Redirect::to('404');
             }
             return \View::make('downloads.show')->with('entry', $dl);
         } else {
             $dl = Downloads::where('name', '=', $name)->where('trash', '=', '0')->first();
             if (is_null($dl)) {
                 return \Redirect::to('404');
             }
             return \View::make('downloads.show')->with('entry', $dl);
         }
     } else {
         if (is_numeric($name)) {
             $dl = Downloads::where('id', '=', $name)->where('trash', '=', '0')->where('state', '=', '1')->first();
             if (is_null($dl)) {
                 return \Redirect::to('404');
             }
             return \View::make('downloads.show')->with('entry', $dl);
         } else {
             $dl = Downloads::where('name', '=', $name)->where('trash', '=', '0')->where('state', '=', '1')->first();
             if (is_null($dl)) {
                 return \Redirect::to('404');
             }
             return \View::make('downloads.show')->with('entry', $dl);
         }
     }
 }
开发者ID:VertexDezign,项目名称:VertexDezign,代码行数:32,代码来源:DownloadsController.php

示例15: index

 public function index(\App\Gameweek $gameweek = null, \App\Month $month = null)
 {
     $user = null;
     $users = \App\User::ranked()->orderBy('rank')->get();
     $lastFixture = \App\Fixture::over()->orderBy('kickoff', 'desc')->first();
     $activeTabs = ['active', '', ''];
     if (!$month or !$month->hasStarted()) {
         $month = $lastFixture->gameweek->month;
     } else {
         $activeTabs = ['', 'active', ''];
     }
     if (!$gameweek or !$gameweek->hasCompletedFixture()) {
         $gameweek = $lastFixture->gameweek;
     } else {
         $activeTabs = ['', '', 'active'];
     }
     if (\Auth::check()) {
         $user = \Auth::user();
     }
     $months = \App\Month::orderBy('id', 'desc')->get()->filter(function ($month) {
         return $month->hasStarted();
     });
     $gameweeks = \App\Gameweek::orderBy('id', 'desc')->get()->filter(function ($gw) {
         return $gw->hasCompletedFixture();
     });
     $gameweekUsers = $gameweek->predictors()->orderBy('gameweek_user.rank', 'asc')->get();
     $monthUsers = $month->users()->orderBy('month_user.rank', 'asc')->get();
     $nameOfPage = 'standings';
     return view('pages.standings', compact('gameweeks', 'months', 'users', 'gameweekUsers', 'monthUsers', 'month', 'gameweek', 'user', 'activeTabs', 'nameOfPage'));
 }
开发者ID:unknowncoders,项目名称:plPredict,代码行数:30,代码来源:StandingsController.php


注:本文中的App\Http\Controllers\Auth::check方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。