本文整理汇总了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');
}
示例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');
}
}
示例3: index
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
if (\Auth::check()) {
return view('home');
}
return redirect()->action('HomeController@index');
}
示例4: logout
public function logout()
{
if (\Auth::check()) {
\Auth::logout();
}
return \Redirect::back();
}
示例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('/');
}
}
示例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';
}
}
示例7: getLogin
public function getLogin()
{
if (\Auth::check()) {
\Auth::user()->email;
}
return view('pages.users.login');
}
示例8: check
public function check()
{
if (\Auth::check()) {
return Response::json(array('result' => true, 'data' => 'Authed'));
}
return Response::json(array('result' => false, 'data' => 'fail'));
}
示例9: logout
/**
* Logout
*
* @return Response
*/
public function logout()
{
if (\Auth::check()) {
\Auth::logout();
}
return \Redirect::route('home.index');
}
示例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'));
}
示例11: create
public function create()
{
if (Auth::check()) {
return Redirect::to("/admin");
}
return View::make("sessions.create");
}
示例12: __construct
public function __construct()
{
$this->middleware('auth', ['except' => 'create']);
if (\Auth::check()) {
$this->middleware('filter');
}
}
示例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('/');
}
}
}
示例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);
}
}
}
示例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'));
}