本文整理汇总了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('/');
}
示例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);
}
示例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');
}