当前位置: 首页>>代码示例>>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;未经允许,请勿转载。