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


PHP Auth::getUser方法代码示例

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


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

示例1: getAuthenticatedUser

 /**
  * @author WN
  * @return \App\User
  * @throws ModelNotFoundException
  */
 protected function getAuthenticatedUser()
 {
     if (\Auth::getUser()) {
         return \Auth::getUser();
     }
     throw new ModelNotFoundException('Authenticated user not found');
 }
开发者ID:paybreak,项目名称:basket,代码行数:12,代码来源:Controller.php

示例2: getlaporan

 public function getlaporan()
 {
     if (\Auth::check() && \Auth::getUser()->getAttribute('admin') == 1) {
         $orders = \DB::table('order')->get();
         return view('admin.home', compact('orders'));
     } else {
         return redirect('home');
     }
 }
开发者ID:cuppyzh,项目名称:go_laundry,代码行数:9,代码来源:AdminController.php

示例3: disabled

 /**
  * Аккаунт не активен
  */
 public function disabled()
 {
     $user = \Auth::getUser();
     if ($user->is_active) {
         return redirect(route('profile'));
     } else {
         return view('user/disabled')->with(['user' => $user]);
     }
 }
开发者ID:errogaht,项目名称:bv-table,代码行数:12,代码来源:UserController.php

示例4: update

 /**
  * Сохранить свой Профиль
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request)
 {
     $user = \Auth::getUser();
     $user->fill($request->all());
     $validator = \Validator::make($user->getAttributes(), $rules = self::getValidatorRules($user->id));
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $user->save();
     return redirect('profile');
 }
开发者ID:errogaht,项目名称:bv-table,代码行数:17,代码来源:ProfileController.php

示例5: store

 /**
  * Добавить коммент
  *
  * @param  \Illuminate\Http\Request $request
  * @param                           $id
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request, $id)
 {
     $contact = \App\Contact::findOrFail($id);
     $data = $request->input();
     $validator = \Validator::make($data, $rules = self::getValidatorRules());
     if (!$validator->fails()) {
         $model = new ContactLog($request->input());
         $model->user_id = \Auth::getUser()->id;
         $model->contact_id = $contact->id;
         $model->save();
     }
     return redirect(route('contact.show', $contact));
 }
开发者ID:errogaht,项目名称:bv-table,代码行数:20,代码来源:ContactLogController.php

示例6: myAccount

 /**
  * get user details and display
  */
 public function myAccount()
 {
     $user = Auth::getUser();
     return View::make('user_account', compact('user'));
 }
开发者ID:phillipmadsen,项目名称:app,代码行数:8,代码来源:LivePageController.php

示例7: status

 /**
  * Изменить Статус
  *
  * @param \Illuminate\Http\Request $request
  * @param                          $id
  * @param                          $status
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function status(Request $request, $id, $status)
 {
     /** @var Contact $contact */
     $contact = Contact::findOrFail($id);
     // TODO: проверка, что пользователю разрешен перевод в выбранный статус
     if ($contact->status != $status) {
         $contact->status = $status;
         $contact->change_status_comment = $request->get('comment');
         switch ($status) {
             case \App\Contact::STATUS_WORK:
             case \App\Contact::STATUS_SUCCESS:
                 $contact->taken_by = \Auth::getUser()->id;
                 $contact->taken_at = new \DateTime();
                 break;
             case \App\Contact::STATUS_FAIL:
                 if (!$contact->change_status_comment) {
                     Flash::error('Укажите причину отказа');
                     goto redirect;
                 }
                 //break;
             //break;
             case \App\Contact::STATUS_NEW:
                 $contact->taken_by = null;
                 $contact->taken_at = null;
                 break;
             default:
                 goto redirect;
         }
         $contact->save();
     }
     redirect:
     return redirect(route('contact.show', $contact));
 }
开发者ID:errogaht,项目名称:bv-table,代码行数:41,代码来源:ContactController.php


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