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


PHP Auth::check方法代码示例

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


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

示例3: myWatchlist

 public function myWatchlist()
 {
     if (Auth::check() && Watchlist::where('user_id', Auth::user()->id)->where('art_id', $this->id)->exists()) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:jonasvr,项目名称:auction,代码行数:8,代码来源:Art.php

示例4: tipoUserLogado

 public static function tipoUserLogado()
 {
     if (!\Auth::check()) {
         return "*";
     }
     $user = User::whereRaw('name=?', [\Auth::user()->name]);
     if ($user->count() == 1) {
         return $user->first()->tipo;
     }
     return "";
 }
开发者ID:AndreSantosCosta,项目名称:sigoc,代码行数:11,代码来源:User.php

示例5: getQotd

 /**
  * @return string
  */
 public static function getQotd()
 {
     if (Cache::has('qotd')) {
         $quote = Cache::get('qotd');
         if (is_null($quote->speaker)) {
             return "<span class='text-lg'>&#8220;</span> {$quote->text} <span class='text-lg'>&#8221;</span>";
         } else {
             return "<span class='text-lg'>&#8220;</span> {$quote->text} <span class='text-lg'>&#8221;</span><br> - {$quote->speaker}";
         }
     } else {
         if (\Auth::check() && \Auth::user()->isAdmin()) {
             return "<span class='text-danger'><i>No Quote set as Quote of the Day and so a random quote will be shown to public.</i></span>";
         }
         $quote = self::random();
         if (is_null($quote->speaker)) {
             return "<span class='text-lg'>&#8220;</span> {$quote->text} <span class='text-lg'>&#8221;</span>";
         } else {
             return "<span class='text-lg'>&#8220;</span> {$quote->text} <span class='text-lg'>&#8221;</span><br> - {$quote->speaker}";
         }
     }
 }
开发者ID:kinnngg-lenz,项目名称:csacerc,代码行数:24,代码来源:Quote.php

示例6: 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

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