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


PHP Auth::id方法代码示例

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


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

示例1: customCreate

 public static function customCreate(CreateConversationRequest $request)
 {
     $conv = new Conversation();
     $conv->Title = $request->Title;
     // if nothing specified in the request
     if (!$request->has('user_id')) {
         // if we are not even logged ( happen while seeding base)
         if (!\Auth::check()) {
             $conv->user_id = User::first()->id;
         } else {
             $conv->user_id = \Auth::id();
         }
     }
     // if Pending status is specified we take it, if not default value will be applied (false)
     if (!$request->has('Pending')) {
         $conv->Pending = $request->Pending;
     }
     $conv->created_at = Carbon::now();
     $conv->save();
     // When conversation is settled the Thread can be created
     $thread = new Thread();
     $thread->user_id = $conv->user_id;
     $thread->Content = $request->Content;
     $thread->conversation_id = $conv->id;
     $thread->created_at = Carbon::now();
     $thread->Pending = $conv->Pending;
     $thread->save();
     return true;
 }
开发者ID:yves01,项目名称:dashboard,代码行数:29,代码来源:Conversation.php

示例2: scopeForUser

 function scopeForUser($query, $id)
 {
     if (!$id) {
         $id = Auth::id();
     }
     $query->whereHas('user_id', function ($query) use($id) {
         $query->where('id', $id);
     });
 }
开发者ID:system3d,项目名称:consultas-tecnicas,代码行数:9,代码来源:Project.php

示例3: getSchedulesForDropdown

 public function getSchedulesForDropdown()
 {
     # Only let the user see their schedules
     $schedules = $this->where('user_id', '=', \Auth::id())->orderby('name', 'ASC')->get();
     $schedules_for_dropdown = [];
     foreach ($schedules as $schedule) {
         $schedules_for_dropdown[$schedule->id] = $schedule->name;
     }
     return $schedules_for_dropdown;
 }
开发者ID:eldaronco,项目名称:p4,代码行数:10,代码来源:Schedule.php

示例4: scopeOwner

 public function scopeOwner($q)
 {
     return $q->whereUserId(Auth::id());
 }
开发者ID:sotoplatero,项目名称:lacallemonte,代码行数:4,代码来源:Favorite.php

示例5: scopeUpdateIdleUser

 /**
  * [scopeUserIdle description]
  * @return [type] [description]
  */
 public function scopeUpdateIdleUser(Builder $query)
 {
     return $query->where('id', Session::getId())->update(['user_id' => \Auth::id()]);
 }
开发者ID:Crisfole,项目名称:LAZ,代码行数:8,代码来源:Online.php

示例6: scopeAuth

 public function scopeAuth($query, $input = false)
 {
     return $query->where('user_id', \Auth::id())->whereIn('action_type_id', $this->actionsType);
     //trans('notices.actions')
 }
开发者ID:rolka,项目名称:antVel,代码行数:5,代码来源:Notice.php

示例7: notReadCount

 public function notReadCount()
 {
     return $this->messages()->selectRaw('conversation_id, count(*) as aggregate')->where('user_id', '!=', \Auth::id())->where('read', '=', 0)->groupBy('conversation_id');
 }
开发者ID:charlieboo,项目名称:creatrip,代码行数:4,代码来源:Conversation.php

示例8: cantUpdate

 public static function cantUpdate($id)
 {
     return \Auth::check() && (\Auth::id() == $id || \Auth::user() && in_array(\Auth::user()->role, ['admin', 'root']));
 }
开发者ID:ant-vel,项目名称:Web,代码行数:4,代码来源:User.php

示例9: checkoutToMe

 /**
  * Checkout this model to the logged in user
  * @method checkoutToMe
  * @return [type]       [description]
  */
 public function checkoutToMe()
 {
     return $this->checkoutToId(\Auth::id());
 }
开发者ID:Gimcrack,项目名称:terntables,代码行数:9,代码来源:Model.php

示例10: isSameUser

 public function isSameUser()
 {
     return (bool) ($this->user_id === \Auth::id());
 }
开发者ID:Gimcrack,项目名称:terntables,代码行数:4,代码来源:RecordLock.php

示例11: scopeForLoggedInUser

 public function scopeForLoggedInUser($query)
 {
     return $query->where('user_id', Auth::id());
 }
开发者ID:MedElans,项目名称:library,代码行数:4,代码来源:Book.php

示例12: scopeVisible

 /**
  * @param Builder|\Illuminate\Database\Eloquent\Builder|Profile $query
  * @return mixed
  */
 public function scopeVisible($query)
 {
     return $query->where(function ($query) {
         $query = $query->approved();
         if (\Auth::check()) {
             $query = $query->orWhere('user_id', \Auth::id());
         }
         return $query;
     });
 }
开发者ID:productionEA,项目名称:pockeyt-api,代码行数:14,代码来源:Profile.php


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