當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Auth::check方法代碼示例

本文整理匯總了PHP中Illuminate\Support\Facades\Auth::check方法的典型用法代碼示例。如果您正苦於以下問題:PHP Auth::check方法的具體用法?PHP Auth::check怎麽用?PHP Auth::check使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Support\Facades\Auth的用法示例。


在下文中一共展示了Auth::check方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: start

 public function start()
 {
     if (Auth::check()) {
         return \View::make('dashboard')->with('name', 'ritesh');
     }
     return Redirect::to('auth/login');
 }
開發者ID:ag22494,項目名稱:studyhere,代碼行數:7,代碼來源:DashboardController.php

示例2: edit

 public function edit(Donations $donations)
 {
     if (!Auth::check()) {
         return redirect('donations');
     }
     return view('edit', compact('donations'));
 }
開發者ID:Tropuska,項目名稱:DWA-seminar2,代碼行數:7,代碼來源:DonationsController.php

示例3: it_logs_a_user_out

 /**
  * @test
  */
 public function it_logs_a_user_out()
 {
     $this->preparePageContent();
     $user = factory('App\\User')->create();
     $this->actingAs($user)->visit('admin/logout');
     $this->assertFalse(Auth::check(), 'user not logged out');
 }
開發者ID:michaeljoyner,項目名稱:expeditionists,代碼行數:10,代碼來源:AuthTest.php

示例4: addTask

 public function addTask(Request $req, $name_liste)
 {
     $param = $req::all();
     if ($param['task'] != "" && strtotime($param['date']) != 0) {
         $tache = new \App\Tache();
         $tache->name_user = Auth::user()->email;
         $tache->name_liste = $name_liste;
         $tache->etat_tache = "No";
         $tache->tache = $param['task'];
         $tache->date = $param['date'];
         $tache->save();
         // Update nombre de tâche de Liste
         $log = Auth::user()->email;
         $liste = new \App\Liste();
         $liste = Liste::where('name_liste', $name_liste)->where('name_user', $log)->first();
         $liste->tache_tot = $liste->tache_tot + 1;
         $liste->save();
         return redirect()->route('index');
     } else {
         //
         //$this->fail = 'erreur';
         //echo $this->fail ;
         if (Auth::check()) {
             $log = Auth::user()->email;
             $todo = DB::table('listes')->where('name_user', $log)->get();
         } else {
             $todo = null;
         }
         $this->erreur = "yes";
         return view('index', ['todo' => $todo, 'erreur' => $this->erreur]);
     }
 }
開發者ID:leloulight,項目名稱:ProjetTIN,代碼行數:32,代碼來源:TODOController.php

示例5: handle

 public function handle($request, Closure $next)
 {
     if (!Auth::check()) {
         return redirect('/login');
     }
     return $next($request);
 }
開發者ID:anonymous-fami,項目名稱:anonymous-web,代碼行數:7,代碼來源:WithAuth.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     if (!Auth::check() || !Auth::guard($guard)->user()->admin) {
         return redirect('/');
     }
     return $next($request);
 }
開發者ID:Necrotex,項目名稱:lootsheet,代碼行數:14,代碼來源:Administrator.php

示例7: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     if (Auth::check()) {
         return redirect('/home');
     }
     return view('auth.login');
 }
開發者ID:snehachavan21,項目名稱:timesheet,代碼行數:12,代碼來源:UserController.php

示例8: handle

 public function handle($request, Closure $next)
 {
     if (Auth::check() && Auth::user()->isAdmin()) {
         return $next($request);
     }
     return redirect('/');
 }
開發者ID:paulmaclean,項目名稱:laravelUserProfiles,代碼行數:7,代碼來源:Admin.php

示例9: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if (Auth::check()) {
         return true;
     }
     return false;
 }
開發者ID:jovvybersamin,項目名稱:laravel-edronscateringservices,代碼行數:12,代碼來源:EventRequest.php

示例10: earnedAchievements

 public function earnedAchievements()
 {
     if (empty($this->earned)) {
         if (Auth::check()) {
             $from_lesson = $this->course->achievements()->where('lesson_id', $this->id)->get();
             $from_num_lessons = [];
             $fnl = $this->course->achievements()->whereNotNull('num_lessons')->get();
             foreach ($fnl as $a) {
                 if (Auth::user()->lessons()->where('course_id', $this->course->id)->count() >= $a->num_lessons) {
                     $from_num_lessons[] = $a;
                 }
             }
             $achievements = array_merge($from_lesson->all(), $from_num_lessons);
             //$own_achievements = Auth::user()->achievements;
             $earned = [];
             foreach ($achievements as $a) {
                 if (Auth::user()->achievements()->where('achievement_id', $a->id)->count() == 0) {
                     $earned[] = $a;
                 }
             }
             foreach ($earned as $a) {
                 Auth::user()->achievements()->attach($a->id);
             }
             $this->earned = $earned;
             return collect($earned);
         } else {
             return collect([]);
         }
     } else {
         return collect($this->earned);
     }
 }
開發者ID:joaopluis,項目名稱:oldschool,代碼行數:32,代碼來源:Lesson.php

示例11: newPost

 /**
  * Create a new post
  * @param string $body Content of post, will be run through filters
  * @param integer $threadid Thread ID
  * @param integer| $posterid Poster's ID. Defaults to currently authenticated user
  * @param bool|false $hidden Is the post hidden from normal view?
  * @param bool|true $save Should the post be automatically saved into the database?
  * @return Post The resulting post object
  */
 public static function newPost($body, $threadid, $posterid = null, $hidden = false, $save = true)
 {
     // Check users rights
     if (!Auth::check() && $posterid === null) {
         abort(403);
         // 403 Forbidden
     }
     // Check thread
     $thread = Thread::findOrFail($threadid);
     if ($thread->locked) {
         abort(403);
         // 403 Forbidden
     }
     // Run post through filters
     $body = PostProcessor::preProcess($body);
     // Create new post
     $post = new Post();
     $post->thread_id = $threadid;
     $post->poster_id = Auth::user()->id;
     $post->body = $body;
     $post->hidden = $hidden;
     // defaults to false
     // Put post into database
     if ($save) {
         $post->save();
     }
     return $post;
 }
開發者ID:harmjanhaisma,項目名稱:clearboard,代碼行數:37,代碼來源:Post.php

示例12: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string|null  $guard
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::check() && Auth::user()->username == Auth::user()->facebook_id && strpos($request->route()->getName(), 'user') === false) {
         return redirect()->route('user/editSelf')->with('message', 'You must finish editing your account.');
     }
     return $next($request);
 }
開發者ID:TheJokersThief,項目名稱:Eve,代碼行數:15,代碼來源:UnfinishedUser.php

示例13: getLoginAction

 public function getLoginAction()
 {
     if (Auth::check()) {
         return redirect('/admin');
     }
     return view('admin.login');
 }
開發者ID:chelizminska,項目名稱:laravel_new,代碼行數:7,代碼來源:AuthController.php

示例14: login

 public function login()
 {
     if (Auth::check() && Auth::user()->isAdmin()) {
         return redirect('admin/dashboard');
     }
     return view('auth/admin-login', ['body_class' => 'login']);
 }
開發者ID:kudosagency,項目名稱:kudos-php,代碼行數:7,代碼來源:AdminController.php

示例15: index

 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     if (Auth::check() && Auth::user()->admin) {
         return redirect()->route('admin');
     }
     return redirect()->route('etudiant');
 }
開發者ID:zi9o,項目名稱:projet-cv,代碼行數:12,代碼來源:UserController.php


注:本文中的Illuminate\Support\Facades\Auth::check方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。