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


PHP Auth::isAdmin方法代码示例

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


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

示例1: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::user()->isLaunchController() || Auth::isAdmin()) {
         return $next($request);
     }
     return redirect('/');
 }
开发者ID:RoryStolzenberg,项目名称:spacexstats,代码行数:14,代码来源:IsLaunchControllerMiddleware.php

示例2: delete

 public function delete($object_id, $comment_id)
 {
     $comment = Comment::find($comment_id);
     // Make sure that the request for deletion is either coming from an admin or from the user who owns the comment
     // and that it isn't already trashed
     if ((Auth::isAdmin() || $comment->user_id == Auth::id()) && !$comment->trashed()) {
         $comment->delete();
         return response()->json(null, 204);
     }
     return response()->json(null, 402);
 }
开发者ID:RoryStolzenberg,项目名称:spacexstats,代码行数:11,代码来源:CommentsController.php

示例3: live

 /**
  * GET, /live. Fetches SpaceXStats Live.
  *
  * @return \Illuminate\View\View
  */
 public function live()
 {
     $isAuthed = Auth::check() && Auth::user()->isLaunchController() || Auth::isAdmin();
     $js = ['auth' => $isAuthed, 'mission' => Mission::future()->first(), 'isActive' => Redis::get('live:active') == true, 'updates' => collect(Redis::lrange('live:updates', 0, -1))->map(function ($update) {
         return json_decode($update);
     }), 'countdown' => Redis::hgetall('live:countdown'), 'title' => Redis::get('live:title'), 'reddit' => Redis::hgetall('live:reddit'), 'sections' => json_decode(Redis::get('live:sections')), 'resources' => json_decode(Redis::get('live:resources')), 'description' => Redis::hgetall('live:description'), 'streams' => ['spacex' => json_decode(Redis::hget('live:streams', 'spacex')), 'spacexClean' => json_decode(Redis::hget('live:streams', 'spacexClean')), 'nasa' => json_decode(Redis::hget('live:streams', 'nasa'))], 'status' => ['text' => Redis::get('live:status')]];
     if ($isAuthed) {
         $js['cannedResponses'] = Redis::hgetall('live:cannedResponses');
     }
     JavaScript::put($js);
     return view('live');
 }
开发者ID:RoryStolzenberg,项目名称:spacexstats,代码行数:17,代码来源:LiveController.php


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