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


PHP Auth::user方法代碼示例

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


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

示例1: post

 public function post()
 {
     $file = array('users' => Request::all());
     // setting up rules
     $rules = array('users' => 'required', 'mimes' => 'jpeg,jpg,png', 'max' => '200px');
     //mimes:jpeg,bmp,png and for max size max:10000
     // doing the validation, passing post data, rules and the messages
     $validator = Validator::make($file, $rules);
     if ($validator->fails()) {
         // send back to the page with the input data and errors
         return redirect('settings')->withInput()->withErrors($validator);
     } else {
         // checking file is valid.
         if (Input::file('user_image')->isValid()) {
             $extension = Input::file('user_image')->getClientOriginalExtension();
             // getting image extension
             $fileName = rand(11111, 99999) . '.' . $extension;
             // renaming image
             Input::file('user_image')->move('uploads/', $fileName);
             // uploading file to given path
             $file->user_image = $fileName;
             \Auth::user()->post->save();
             // sending back with message
             \Session::flash('flash_message', 'You have successfully updated your codename!');
             return redirect('settings');
         } else {
             // sending back with error message.
             \Session::flash('error', 'uploaded file is not valid');
             return redirect('home');
         }
     }
 }
開發者ID:TUPM-BSCS,項目名稱:iConfess,代碼行數:32,代碼來源:User.php

示例2: put

 public function put($data)
 {
     $this->fill($data);
     $this->user_id = \Auth::user()->id;
     $this->save();
     return $this;
 }
開發者ID:kilrizzy,項目名稱:laraticket,代碼行數:7,代碼來源:Client.php

示例3: scopeClient

 public function scopeClient($query, $request)
 {
     //$query->join('projects','claim.project_id','=','projects.id');
     if (!empty($request['created_at_from']) && !empty($request['created_at_to'])) {
         $dtFrom = new \DateTime($request['created_at_from']);
         $dtTo = new \DateTime($request['created_at_to']);
         $query->whereBetween('claims.created_at', [$dtFrom->format('Y-m-d 00:00:00'), $dtTo->format('Y-m-d 23:59:59')]);
     } elseif (!empty($request['created_at_from']) && empty($request['created_at_to'])) {
         $dtFrom = new \DateTime($request['created_at_from']);
         $dtTo = new \DateTime();
         $query->whereBetween('claims.created_at', [$dtFrom->format('Y-m-d 00:00:00'), $dtTo->format('Y-m-d 23:59:59')]);
     } elseif (empty($request['created_at_from']) && !empty($request['created_at_to'])) {
         $dtFrom = new \DateTime($request['created_at_to']);
         $dtTo = new \DateTime('created_at_to');
         $query->whereBetween('claims.created_at', [$dtFrom->format('Y-m-d 00:00:00'), $dtTo->format('Y-m-d 23:59:59')]);
     }
     if (!empty($request['status'])) {
         $query->where('claims.status', $request['status']);
     }
     if (!empty($request['id'])) {
         $query->where('claims.id', (int) $request['id']);
     }
     if (!empty($request['name'])) {
         $query->where('claims.name', 'like', "%" . $request['name'] . "%");
     }
     if (!empty($request['phone'])) {
         $query->where('claims.phone', 'like', "%" . $request['phone'] . "%");
     }
     $query->join('projects', function ($join) {
         $join->on('claims.project_id', '=', 'projects.id')->where('projects.client_id', '=', \Auth::user()->id);
     });
     $query->orderBy('claims.id', 'desc')->get(["claims.*"]);
 }
開發者ID:avinaszh,項目名稱:callcenter,代碼行數:33,代碼來源:Claim.php

示例4: uploadBeerImg_callback

 public static function uploadBeerImg_callback($request, $fileimage)
 {
     $image_unique_id = date('Ymdhis') . rand(0, 9999);
     $beer_meta = new BeerImg();
     $beer_meta->beer_id = $request['beer_id'];
     $beer_meta->description = !empty($request['img_description']) ? $request['img_description'] : null;
     $beer_name = !empty($request['img_description']) ? $request['img_description'] : null;
     $imageName = "beerhit.com_" . strtolower($beer_name) . $request['beer_id'] . $image_unique_id . '.' . $fileimage->getClientOriginalExtension();
     $path = public_path('/images/catalog/' . $imageName);
     $img = ImageManagerStatic::make($fileimage);
     // resize the image to a width of 960
     // and constrain aspect ratio (auto width)
     $img->resize(960, null, function ($constraint) {
         $constraint->aspectRatio();
         $constraint->upsize();
     });
     $img->save($path);
     //Save image information to database
     $beer_meta->img_id = $image_unique_id;
     $beer_meta->filename = $imageName;
     $beer_meta->path = '/images/catalog/' . $imageName;
     $beer_meta->user_id = \Auth::user()->id;
     $beer_meta->place_id = $request['fb_place_id'];
     $beer_meta->save();
     \UserBeerHelper::userLog(\Auth::user()->id, $request['beer_id'], 200, $request['fb_place_id'], $image_unique_id);
 }
開發者ID:ktardthong,項目名稱:beerhit,代碼行數:26,代碼來源:BeerImg.php

示例5: getNiveauPrice

 public static function getNiveauPrice($niveau)
 {
     if (\Auth::user()->pricebills()->where('niveau', $niveau)->first()) {
         $price = \Auth::user()->pricebills()->where('niveau', $niveau)->first();
         return $price->prix;
     }
 }
開發者ID:khaleader,項目名稱:creche,代碼行數:7,代碼來源:PriceBill.php

示例6: getNotReadMessagesById

 public function getNotReadMessagesById($id)
 {
     $count = $this->where('id_receive', \Auth::user()->id)->where('read', NULL)->where('dialog_id', $id)->count();
     if ($count) {
         return '(' . $count . ')';
     }
 }
開發者ID:zluy4yvak,項目名稱:chat,代碼行數:7,代碼來源:Message.php

示例7: totalMonthlyCoverage

 public static function totalMonthlyCoverage()
 {
     $visitClass = Customer::select('class')->where('mr_id', \Auth::user()->id)->get()->toArray();
     $totalVisitsCount = VisitClass::whereIn('name', $visitClass)->sum('visits_count');
     $actualVisitsCount = Report::where('mr_id', \Auth::user()->id)->where('month', date('M') . '-' . date('Y'))->count();
     return number_format($actualVisitsCount / $totalVisitsCount * 100, 2);
 }
開發者ID:m-gamal,項目名稱:crm,代碼行數:7,代碼來源:Customer.php

示例8: checkSua

 public static function checkSua($chucnang)
 {
     $rolechucnangs = RoleChucnang::join('danhmucchucnangs', 'role_chucnangs.danhmucchucnang_id', '=', 'danhmucchucnangs.id')->where('role_id', \Auth::user()->role_id)->where('danhmucchucnangs.chucnang_id', $chucnang)->first();
     if ($rolechucnangs->Sua == 1) {
         return TRUE;
     }
     return FALSE;
 }
開發者ID:thaigialai1987,項目名稱:qlcv,代碼行數:8,代碼來源:Role.php

示例9: isLoggedUser

 /**
  * @return boolean returns <b>true</b> if this User model is the user we logged in as.
  */
 public function isLoggedUser()
 {
     $authUser = \Auth::user();
     if (!empty($authUser) && $authUser->id == $this->id) {
         return true;
     }
     return false;
 }
開發者ID:Ravaelles,項目名稱:Elder,代碼行數:11,代碼來源:User.php

示例10: isBingoPlayer

 public function isBingoPlayer()
 {
     if (\Auth::user()->role->role == 'bp') {
         return true;
     } else {
         return false;
     }
 }
開發者ID:botlax,項目名稱:ttcattendance,代碼行數:8,代碼來源:User.php

示例11: isAdmin

 public function isAdmin()
 {
     $user = \Auth::user()->toArray();
     if ($user['isAdmin'] == 1) {
         return true;
     }
     return false;
 }
開發者ID:slaleye,項目名稱:securechat,代碼行數:8,代碼來源:User.php

示例12: isSkrbnik

 public function isSkrbnik()
 {
     if (\Auth::user()->type == 4) {
         return true;
     } else {
         return false;
     }
 }
開發者ID:Kokanm,項目名稱:eStudentLaravel,代碼行數:8,代碼來源:User.php

示例13: isMe

 public function isMe()
 {
     if ($this->id == \Auth::user()->id) {
         return true;
     } else {
         return false;
     }
 }
開發者ID:mikebywater,項目名稱:m8d8,代碼行數:8,代碼來源:User.php

示例14: userReadDiscussion

 public function userReadDiscussion()
 {
     if (\Auth::check()) {
         return $this->hasMany('App\\UserReadDiscussion')->where('user_id', '=', \Auth::user()->id);
     } else {
         abort(500, 'Need to be logged in to access this userReadDiscussion relation');
     }
 }
開發者ID:philippejadin,項目名稱:Mobilizator,代碼行數:8,代碼來源:Discussion.php

示例15: complete

 public function complete()
 {
     if ($this->completed_at != null) {
         throw new \Exception('Task already completed');
     }
     $this->completed_at = new Carbon();
     $this->completed_by = \Auth::user()->id;
 }
開發者ID:BostjanOb,項目名稱:ProTODO,代碼行數:8,代碼來源:Task.php


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