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


PHP Auth::getUser方法代碼示例

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


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

示例1: postUpdate

 public function postUpdate($id, Request $request)
 {
     $user = Auth::getUser();
     if ($user->email == $request->get('email')) {
         // user try to change own password
         $validatorRules = ['password' => 'confirmed|min:6'];
     } else {
         // user try another email
         $validatorRules = ['email' => 'required|email|max:255|unique:users', 'password' => 'confirmed|min:6'];
     }
     $this->validate($request, $validatorRules);
     $data = $request->all();
     // password crypt
     if (isset($data['password'])) {
         if (empty($data['password'])) {
             unset($data['password']);
         } else {
             $data['password'] = bcrypt($data['password']);
         }
     }
     $user = User::findOrFail($id);
     $user->update($data);
     Flash::success('Benutzerdaten sind aktualisiert.');
     return redirect()->action('Auth\\EditController@getEdit');
 }
開發者ID:alcodo,項目名稱:alpaca,代碼行數:25,代碼來源:EditController.php

示例2: panel

 public function panel()
 {
     $user = Auth::getUser();
     $rooms = $user->rooms()->wherePivot('owner', '=', 1)->get();
     $rooms_foreign = $user->rooms()->wherePivot('owner', '=', 0)->get();
     return view('panel', compact('rooms', 'rooms_foreign'));
 }
開發者ID:taNgoPL,項目名稱:student_groups,代碼行數:7,代碼來源:PanelController.php

示例3: getCurrentUserId

 public function getCurrentUserId()
 {
     $user = Auth::getUser();
     if (!is_null($user)) {
         return $user->email;
     } else {
         return 'guest';
     }
 }
開發者ID:jvelo,項目名稱:datatext,代碼行數:9,代碼來源:LaravelUserProvider.php

示例4: show

 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $group = RoomGroup::with('room')->find($id);
     $room = $group->room;
     $user = Auth::getUser();
     $isOwner = $room->checkIfUserIsOwner($user->id);
     $comments = $group->comments()->paginate(5);
     $comments->setPath(route('room.groups.show', [$room->id, $id]));
     return view('group', compact('group', 'room', 'user', 'isOwner', 'comments'));
 }
開發者ID:taNgoPL,項目名稱:student_groups,代碼行數:16,代碼來源:GroupsController.php

示例5: 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, $guard = null)
 {
     if (Auth::guard($guard)->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('login');
         }
     } else {
         if (Auth::getUser() and Auth::getUser()->type == 1) {
             if (substr($request->path(), 0, 5) == 'admin') {
                 return redirect('/');
             } else {
                 return $next($request);
             }
         } else {
             return $next($request);
         }
     }
     //return $next($request);
 }
開發者ID:brunomartins-com,項目名稱:espacofarmaceutico,代碼行數:29,代碼來源:Authenticate.php

示例6: isJudged

 public function isJudged($comment_id)
 {
     return $this->commentjudge->where('comment_id', $comment_id)->where('stu_id', Auth::getUser()->stu_id)->first() !== null;
 }
開發者ID:e19940604,項目名稱:Cyinf,代碼行數:4,代碼來源:CommentjudgeRepository.php

示例7: join

 public function join(Request $request)
 {
     $room = Room::code($request->input('code'))->first();
     if (!$room) {
         return redirect()->route('panel');
     }
     $user = Auth::getUser();
     if (!in_array($room->id, $room->users->lists('id')->all())) {
         $user->rooms()->attach($room->id);
     }
     return redirect()->route('rooms.show', $room->id);
 }
開發者ID:taNgoPL,項目名稱:student_groups,代碼行數:12,代碼來源:RoomsController.php

示例8: getJobs

 public function getJobs()
 {
     $jobs = Job::where("company_id", Auth::getUser()->company_id)->with(["company", "customer"]);
     return view("jobs", ["jobs" => $jobs]);
 }
開發者ID:younggeeks,項目名稱:twentyKitonga,代碼行數:5,代碼來源:TestController.php

示例9: postAddForumNewTopicAction

 public function postAddForumNewTopicAction()
 {
     $user = Auth::getUser();
     Page::create(array('title' => Input::get('title'), 'parent_id' => Input::get('parent_page_id'), 'is_sheet' => false, 'is_protected' => false));
     /*  ForumPageMessage::create(array(
             'page_title' => Input::get('title'),
             'content' => Input::get('content'),
             'page_id' => Input::get('parent_page_id'),
             'user' => $user->name,
         ));*/
     return redirect('/admin/contents');
 }
開發者ID:chelizminska,項目名稱:laravel_new,代碼行數:12,代碼來源:BaseController.php

示例10: deleteFavorite

 public function deleteFavorite($course_id)
 {
     return $this->favorite->where('course_id', $course_id)->where('stu_id', Auth::getUser()->stu_id)->delete();
 }
開發者ID:e19940604,項目名稱:Cyinf,代碼行數:4,代碼來源:FavoriteRepository.php

示例11: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return Auth::getUser();
 }
開發者ID:mattvb91,項目名稱:website-laravel,代碼行數:9,代碼來源:PageRequest.php


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