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


PHP Auth::admin方法代码示例

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


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

示例1: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if ($this->route('users') == Auth::admin()->get()->id) {
         return false;
     }
     return true;
 }
开发者ID:badcoy,项目名称:allSystemsGo,代码行数:12,代码来源:DeleteUserRequest.php

示例2: getCanceled

 /**
  * Get the canceled order numbers
  *
  * @param $state
  * @param null $orderNumber
  * @return mixed
  */
 public static function getCanceled($state, $orderNumber = null, $page)
 {
     $perPage = 10;
     $companyIds = [];
     if (Auth::admin()->check()) {
         $companyIds = Company::all()->lists('id')->toArray();
     } elseif (Auth::user()->check()) {
         $companyIds = [Auth::user()->get()->company->id];
     }
     $query = DB::table('canceled_orders')->whereIn('company_id', $companyIds)->take($perPage)->skip($perPage * ($page - 1));
     switch ($state) {
         case 'unconfirmed':
             $query = $query->where('confirmed', false)->where('denied', false);
             break;
         case 'confirmed':
             $query = $query->where('confirmed', true);
             break;
         case 'denied':
             $query = $query->where('denied', true)->where('confirmed_denied', false);
             break;
     }
     if ($orderNumber) {
         $query = $query->where('order_number', $orderNumber);
     }
     return $query->lists('order_number');
 }
开发者ID:dagmawiyehenew,项目名称:laravel-levapp,代码行数:33,代码来源:Order.php

示例3: loginAs

 /**
  * Login as the
  *
  * @param $companyId
  * @return \Illuminate\Http\RedirectResponse
  */
 public function loginAs($companyId)
 {
     $company = Company::findOrFail($companyId);
     $user = $company->users()->first();
     Auth::admin()->impersonate('user', $user->id);
     return redirect()->route('user.dashboard');
 }
开发者ID:dagmawiyehenew,项目名称:laravel-levapp,代码行数:13,代码来源:AuthController.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::admin()->check()) {
         return redirect()->guest('backend');
     }
     return $next($request);
 }
开发者ID:BryceHappy,项目名称:lavender,代码行数:14,代码来源:RedirectIfAuthenticated.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::admin()->check()) {
         return $next($request);
     }
     return redirect()->route('admin.login');
 }
开发者ID:dagmawiyehenew,项目名称:laravel-levapp,代码行数:14,代码来源:AdminAuthMiddleware.php

示例6: handle

 /**
  * Run the request filter.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string  $role
  * @return mixed
  */
 public function handle($request, Closure $next, $permissionName)
 {
     $permission = Permission::where('name', $permissionName)->first();
     if (!Auth::admin()->user()->hasPermission($permission)) {
         abort(403);
     }
     return $next($request);
 }
开发者ID:hlacos,项目名称:lara-mvcms,代码行数:16,代码来源:HasPermission.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::admin()->get()) {
         return $next($request);
     } else {
         return redirect()->guest('admin');
     }
 }
开发者ID:JFSolorzano,项目名称:multiauth,代码行数:15,代码来源:Adminmiddleware.php

示例8: postRegister

 /**
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postRegister(Request $request)
 {
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     Auth::admin()->login($this->create($request->all()));
     return redirect($this->redirectadminPath());
 }
开发者ID:marcellorg,项目名称:auth,代码行数:15,代码来源:AdminRegistersUsers.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::other()->check()) {
         return back();
     }
     if (Auth::admin()->check()) {
         return back();
     }
     return $next($request);
 }
开发者ID:marcellorg,项目名称:auth,代码行数:17,代码来源:userlogout.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::admin()->get()) {
         if ($request->ajax()) {
             return response('Authorized.', 403);
         } else {
             return redirect()->route('lara-mvcms.dashboard');
         }
     }
     return $next($request);
 }
开发者ID:hlacos,项目名称:lara-mvcms,代码行数:18,代码来源:AdminGuest.php

示例11: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!Auth::admin()->get()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->route('lara-mvcms.sessions.create');
         }
     }
     return $next($request);
 }
开发者ID:hlacos,项目名称:lara-mvcms,代码行数:18,代码来源:AdminAuthenticate.php

示例12: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::admin()->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect('auth/login');
         }
     }
     return $next($request);
 }
开发者ID:badcoy,项目名称:allSystemsGo,代码行数:18,代码来源:Authenticate.php

示例13: login

 public function login(Form $form)
 {
     $request = $form->request->all();
     if (!Auth::admin()->logAttempt($request, $mustBeConfirmed = false)) {
         if (Auth::admin()->isThrottled($request)) {
             $error = trans('account.alerts.too_many_attempts');
         } else {
             $error = trans('account.alerts.wrong_credentials');
         }
         Message::addError($error);
         throw new \Exception($error);
     }
 }
开发者ID:BryceHappy,项目名称:lavender,代码行数:13,代码来源:AuthHandler.php

示例14: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::admin()->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         }
         return redirect()->guest('admin/login');
     }
     // Bind the Backend Kernel to our request
     // todo find a better place to register our backend form kernel
     app()->singleton('Lavender\\Contracts\\Form\\Kernel', 'App\\Form\\BackendKernel');
     return $next($request);
 }
开发者ID:BryceHappy,项目名称:lavender,代码行数:20,代码来源:Authenticate.php

示例15: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::admin()->check()) {
         return back();
     }
     if (Auth::other()->check()) {
         return back();
     }
     if (Auth::user()->check()) {
         return redirect('userdashboard');
     }
     return $next($request);
 }
开发者ID:marcellorg,项目名称:auth,代码行数:20,代码来源:RedirectIfAuthenticated.php


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