當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。