當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AuthManager::user方法代碼示例

本文整理匯總了PHP中Illuminate\Auth\AuthManager::user方法的典型用法代碼示例。如果您正苦於以下問題:PHP AuthManager::user方法的具體用法?PHP AuthManager::user怎麽用?PHP AuthManager::user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Auth\AuthManager的用法示例。


在下文中一共展示了AuthManager::user方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 /**
  * @param $request
  * @param callable $next
  * @return mixed
  */
 public function handle($request, \Closure $next)
 {
     if ($this->auth->check()) {
         $this->app->setLocale($this->auth->user()->getLocale());
     }
     return $next($request);
 }
開發者ID:studiocaro,項目名稱:HorseStories,代碼行數:12,代碼來源:Locale.php

示例2: postFork

 public function postFork($hash)
 {
     $parent = $this->repository->getByHash($hash);
     $command = new Commands\CreateForkCommand($this->request->get('code'), $this->auth->user(), $parent);
     $fork = $this->bus->execute($command);
     return $this->redirector->action('BinController@getShow', [$fork->hash]);
 }
開發者ID:sdlyhu,項目名稱:laravelio,代碼行數:7,代碼來源:BinController.php

示例3: getIndex

 public function getIndex()
 {
     $user = $this->auth->user();
     $threads = $this->threadRepository->getRecentByMember($user);
     $replies = $this->replyRepository->getRecentByMember($user);
     $this->render('dashboard.index', compact('user', 'threads', 'replies'));
 }
開發者ID:sdlyhu,項目名稱:laravelio,代碼行數:7,代碼來源:DashboardController.php

示例4: authenticate

 /**
  * Authenticate request with Basic.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Illuminate\Routing\Route  $route
  * @return mixed
  */
 public function authenticate(Request $request, Route $route)
 {
     $this->validateAuthorizationHeader($request);
     if ($response = $this->auth->onceBasic($this->identifier) and $response->getStatusCode() === 401) {
         throw new UnauthorizedHttpException('Basic', 'Invalid authentication credentials.');
     }
     return $this->auth->user();
 }
開發者ID:iwillhappy1314,項目名稱:laravel-admin,代碼行數:15,代碼來源:BasicProvider.php

示例5: compose

 /**
  * composing the view
  *
  * @param \Illuminate\View\View $view
  */
 public function compose(\Illuminate\View\View $view)
 {
     $notifications = [];
     if (null !== ($user = $this->authManager->user())) {
         $notifications = $this->notificationManager->getForUser($user, [NotificationActivity::CREATED, NotificationActivity::READ]);
     }
     $view->with('notifications', $notifications);
 }
開發者ID:ipunkt,項目名稱:laravel-notify,代碼行數:13,代碼來源:ViewComposer.php

示例6: postDelete

 public function postDelete($replyId)
 {
     $reply = $this->replies->requireById($replyId);
     $thread = $reply->thread;
     $command = new Commands\DeleteReplyCommand($reply, $this->auth->user());
     $reply = $this->bus->execute($command);
     return $this->redirector->action('ForumController@getViewThread', [$thread->slug]);
 }
開發者ID:sdlyhu,項目名稱:laravelio,代碼行數:8,代碼來源:ForumRepliesController.php

示例7: create

 /**
  * @param array $data
  * @return \HorseStories\Models\Events\Event
  */
 public function create($data = [])
 {
     $event = new Event();
     $event->name = $data['event_name'];
     $event->creator_id = $this->auth->user()->id;
     $event->save();
     return $event;
 }
開發者ID:studiocaro,項目名稱:HorseStories,代碼行數:12,代碼來源:EventCreator.php

示例8: getPreparedRules

 /**
  * Get the prepared validation rules.
  *
  * @return array
  */
 protected function getPreparedRules()
 {
     $forbidden = implode(',', $this->config->get('config.forbidden_usernames', []));
     $userId = $this->auth->user()->id;
     $this->rules['username'] .= '|not_in:' . $forbidden;
     $this->rules['username'] .= '|unique:users,username,' . $userId;
     return $this->rules;
 }
開發者ID:wmk223,項目名稱:site,代碼行數:13,代碼來源:SettingsForm.php

示例9: create

 /**
  * @param \HorseStories\Models\Statuses\Status $status
  * @param string $body
  * @return \HorseStories\Models\Comments\Comment
  */
 public function create(Status $status, $body)
 {
     $comment = new Comment();
     $comment->status_id = $status->id;
     $comment->body = $body;
     $comment->user_id = $this->auth->user()->id;
     $comment->save();
     return $comment;
 }
開發者ID:studiocaro,項目名稱:HorseStories,代碼行數:14,代碼來源:CommentCreator.php

示例10: collect

 /**
  * @{inheritDoc}
  */
 public function collect()
 {
     try {
         $user = $this->auth->user();
     } catch (\Exception $e) {
         $user = null;
     }
     return $this->getUserInformation($user);
 }
開發者ID:focuslife,項目名稱:v0.1,代碼行數:12,代碼來源:AuthCollector.php

示例11: __construct

 /**
  * Create an instance of the Manager
  *
  * @param  \Illuminate\Routing\Router 			 $router
  * @param  \Illuminate\Database\DatabaseManager  $db
  * @param  \Illuminate\Auth\AuthManager 		 $auth
  * @param  \Illuminate\Config\repository 		 $config
  * @return void
  */
 public function __construct(Router $router, IlluminateDatabaseManager $db, AuthManager $auth, Repository $config)
 {
     $this->db = $db;
     $this->router = $router;
     $this->auth = $auth;
     $this->config = $config;
     // Set the user object
     $this->user = $this->auth->user();
     // Set the role control identifier from config
     $this->roleControlIdentifier = $this->config->get('role::role.control.identifier');
 }
開發者ID:leitom,項目名稱:role,代碼行數:20,代碼來源:DatabaseManager.php

示例12: filter

 public function filter(Route $route, Request $request)
 {
     /** @var \anlutro\Core\Auth\Users\UserModel $user */
     if (!($user = $this->auth->user())) {
         throw new \RuntimeException('auth filter must precede access filter');
     }
     // get an array of function arguments #3 and up
     $params = array_slice(func_get_args(), 2);
     foreach ($params as $access) {
         if (!$user->hasAccess($access)) {
             return $this->makeResponse($request);
         }
     }
 }
開發者ID:anlutro,項目名稱:l4-core,代碼行數:14,代碼來源:AccessFilter.php

示例13: store

 /**
  * Log in the user.
  * 
  * @return \Response
  */
 public function store()
 {
     $input = Input::only('email', 'password');
     $remember = Input::has('remember');
     $this->logInForm->validate($input);
     if (!$this->auth->once($input)) {
         return json(['errors' => trans('errors.credentials')]);
     }
     if (!$this->auth->user()->confirmed) {
         return json(['errors' => trans('errors.not_confirmed')]);
     }
     $this->auth->login($this->auth->user(), $remember);
     return json(true);
 }
開發者ID:adriancatalinsv,項目名稱:fiip,代碼行數:19,代碼來源:LoginController.php

示例14: __construct

 public function __construct(DriverLocationTransformer $driverLocationTransformer, AuthManager $authManager, JsonRespond $jsonRespond)
 {
     parent::__construct($jsonRespond);
     $this->user = $authManager->user();
     $this->jsonRespond = $jsonRespond;
     $this->driverLocationTransformer = $driverLocationTransformer;
 }
開發者ID:GiedriusQ,項目名稱:taksistas,代碼行數:7,代碼來源:LocationsController.php

示例15: __construct

 /**
  * DriversController constructor.
  * @param AuthManager $auth
  * @param User $users
  * @param JsonRespond $jsonRespond
  * @param UserTransformer $userTransformer
  */
 public function __construct(AuthManager $auth, User $users, JsonRespond $jsonRespond, UserTransformer $userTransformer)
 {
     $this->user = $auth->user();
     $this->userTransformer = $userTransformer;
     $this->users = $users;
     parent::__construct($jsonRespond);
 }
開發者ID:GiedriusQ,項目名稱:taksistas,代碼行數:14,代碼來源:DriversController.php


注:本文中的Illuminate\Auth\AuthManager::user方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。