作者:Giedrius
项目:taksista
/**
* 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);
}
作者:Giedrius
项目:taksista
public function __construct(AuthManager $auth, OrderTransformer $orderTransformer, JsonRespond $jsonRespond)
{
parent::__construct($jsonRespond);
$this->user = $auth->user();
$this->orderTransformer = $orderTransformer;
$this->jsonRespond = $jsonRespond;
}
作者:anlutr
项目:l4-cor
public function filter(Route $route, Request $request)
{
if ($this->auth->check()) {
$config = $this->config->get('c::redirect-login');
$url = $config ? $this->url->to($config) : '/';
return $this->redirect->to($url);
}
}
作者:Giedrius
项目:taksista
/**
* Store a newly created resource in storage.
*
* @param OrderRequest $request
* @return \Illuminate\Http\Response
*/
public function store(OrderRequest $request)
{
$order = $this->user->createOrder(['status' => 0] + $request->all());
$order->load('statusHistory');
$order->assignNearestDriver();
return $this->jsonRespond->respondModelStore($this->orderTransformer, $order);
}
作者:Viktor-
项目:LPane
/**
* Handle an incoming request
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->guard()->check()) {
return $this->redirect->route('admin', $this->app->getLocale());
}
return $next($request);
}
作者:devd
项目:sign
/**
* Authenticate request.
*
* @return bool|exception
*/
public function auth()
{
if (!$this->auth->attempt($this->getCredentials())) {
throw new InvalidBasicAuthCredentials();
}
return true;
}
作者:studiocar
项目:HorseStorie
/**
* @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);
}
作者:imanghafoori
项目:boom-cor
/**
* Returns whether the logged in user is allowed to edit a page.
*
* @return bool
*/
public function allowedToEdit(Page $page = null)
{
if ($page === null) {
return true;
}
return Editor::isEnabled() && $this->auth->check('edit', $page);
}
作者:sdlyh
项目:laraveli
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'));
}
作者:sdlyh
项目:laraveli
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]);
}
作者:skimi
项目:api-fusio
/**
* 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 ($user = $this->auth->getUser()) {
return $user;
}
throw new UnauthorizedHttpException(null, 'Please log in before perform this query.');
}
作者:naturalwe
项目:nwlarave
/**
* Get User
*
* @return \Illuminate\Contracts\Auth\Authenticatable
*/
protected function getUser()
{
if (!$this->user) {
$authGuard = $this->config->get('nwlaravel.activity.auth_guard') ?: $this->auth->getDefaultDriver();
$this->user = $this->auth->guard($authGuard)->user();
}
return $this->user;
}
作者:studiocar
项目:HorseStorie
/**
* @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;
}
作者:ipunk
项目:laravel-notif
/**
* 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);
}
作者:iwillhappy131
项目:laravel-admi
/**
* 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();
}
作者:sdlyh
项目:laraveli
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]);
}
作者:wmk22
项目:sit
/**
* 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;
}
作者:focuslif
项目:v0.
/**
* @{inheritDoc}
*/
public function collect()
{
try {
$user = $this->auth->user();
} catch (\Exception $e) {
$user = null;
}
return $this->getUserInformation($user);
}
作者:studiocar
项目:HorseStorie
/**
* @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;
}
作者:adriancatalins
项目:fii
/**
* Confirm user with token.
*
* @param string $token
* @return Response
*/
public function index($token)
{
$user = $this->userRepo->getByConfirmationToken($token);
if (!$user) {
return view('auth.confirm')->withBadToken(true);
}
$user->confirm();
$this->auth->login($user);
return redirect('/');
}