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


PHP Request::getSession方法代码示例

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


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

示例1: createFromExisting

 /**
  * @param \Illuminate\Http\Request $old
  *
  * @return static
  */
 public static function createFromExisting(IlluminateRequest $old)
 {
     $new = new static($old->query->all(), $old->request->all(), $old->attributes->all(), $old->cookies->all(), $old->files->all(), $old->server->all(), $old->content);
     if ($session = $old->getSession()) {
         $new->setSession($old->getSession());
     }
     $new->setRouteResolver($old->getRouteResolver());
     return $new;
 }
开发者ID:khlipeng,项目名称:api,代码行数:14,代码来源:Request.php

示例2: check

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function check(Request $request)
 {
     //        $provider = new \League\OAuth2\Client\Provider\GenericProvider([
     //            'clientId' => '1_2jxb8np5n8o4ss0c4wg8csc4sk0oo8gs88s8coc4kgocg44gks',    // The client ID assigned to you by the provider
     //            'clientSecret' => '52gwqoirmm4gs08cscw0wkowwkc8swk4wg0s0wws8gc0w048sc',   // The client password assigned to you by the provider
     //            'redirectUri' => '',
     //            'urlAuthorize' => '',
     //            'urlAccessToken' => 'localhost/SerbinarioCrudRestApi/web/app_dev.php/oauth/v2/token',
     //            'urlResourceOwnerDetails' => ''
     //       ]);
     try {
         $username = $request->input("username");
         $password = $request->input("password");
         // Try to get an access token using the resource owner password credentials grant.
         $accessToken = OauthClientFacade::getAccessToken('password', ['username' => $username, 'password' => $password]);
         $userUri = 'localhost/SerbinarioCrudRestApi/web/app_dev.php/teste';
         $requestOauth = OauthClientFacade::getAuthenticatedRequest('GET', $userUri, $accessToken);
         $user = OauthClientFacade::getResponse($requestOauth);
         $request->session()->set("user", $user);
         $request->session()->set("access_token", $accessToken);
         //$request->getSession()->set("provider_oauth", $provider);
         $request->getSession()->save();
         return redirect()->route('oauth.client.index');
     } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
         // Failed to get the access token
         exit($e->getMessage());
     } catch (\Error $e) {
         exit($e->getMessage());
         return redirect()->route('oauth.client.login');
     }
 }
开发者ID:serbinario,项目名称:sergestor-cliente,代码行数:36,代码来源:ClientController.php

示例3: handle

 /**
  * Checks if a user has attempted to create their account using any OAUTH API's
  * This is useful, so that afterwards we can display the mini form where they can just enter their password
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->getSession()->has('api_user_data')) {
         return $next($request);
     }
     return redirect()->route('login');
 }
开发者ID:muhamadsyahril,项目名称:ecommerce-1,代码行数:15,代码来源:CreateAccountUsingAPIdata.php

示例4: hasInvalidState

 /**
  * Determine if the current request / session has a mismatching "state".
  *
  * @return bool
  */
 protected function hasInvalidState()
 {
     if ($this->isStateless()) {
         return false;
     }
     $state = $this->request->getSession()->pull('state');
     return !(strlen($state) > 0 && $this->request->input('state') === $state);
 }
开发者ID:arpanrnc,项目名称:socialite-params,代码行数:13,代码来源:AbstractProvider.php

示例5: hasInvalidState

 /**
  * Determine if the current request / session has a mismatching "state".
  *
  * @return bool
  */
 protected function hasInvalidState()
 {
     if ($this->isStateless()) {
         return false;
     }
     $session = $this->request->getSession();
     return !($this->request->input('state') === $session->get('state'));
 }
开发者ID:rafaelign,项目名称:socialite,代码行数:13,代码来源:AbstractProvider.php

示例6: user

 /**
  * Get the authenticated user's details.
  *
  * @throws \AltThree\Login\Exceptions\CannotAccessEmailsException
  * @throws \AltThree\Login\Exceptions\InvalidEmailException
  * @throws \AltThree\Login\Exceptions\InvalidStateException
  * @throws \AltThree\Login\Exceptions\IsBlacklistedException
  * @throws \AltThree\Login\Exceptions\NoEmailException
  * @throws \AltThree\Login\Exceptions\NotWhitelistedException
  *
  * @return string[]
  */
 public function user()
 {
     $state = $this->request->getSession()->pull('state');
     if (strlen($state) !== 40 || $this->request->input('state') !== $state) {
         throw new InvalidStateException('We could not verify the request was genuine.');
     }
     $token = $this->getAccessToken($this->request->input('code'));
     return $this->getUserByToken($token);
 }
开发者ID:AltThree,项目名称:Login,代码行数:21,代码来源:LoginProvider.php

示例7: handle

 /**
  * @param Request $request
  * @param Closure $next
  *
  * @return \Illuminate\Http\Response
  */
 public function handle(Request $request, Closure $next)
 {
     $session = $request->getSession();
     $this->preRequestHandle($session, $request);
     $response = $next($request);
     $session = $request->getSession();
     $this->postRequestHandle($session, $response);
     return $response;
 }
开发者ID:spyc,项目名称:elearn-foundation,代码行数:15,代码来源:CommonSession.php

示例8: callback

 public function callback(Request $request)
 {
     $order = Order::with('payment')->where('sn', '=', $request->get('sn'))->firstOrFail();
     $response = $order->payment->gateway->complete($order->createPurchaseOrder());
     if ($order->payment->gateway->isSuccessful($response)) {
         $order->pay($order->total_amount);
         return redirect($request->getSession()->pull('payment_callback_redirect'));
     } else {
         throw new \Exception($response->getMessage());
     }
 }
开发者ID:kshar1989,项目名称:dianpou,代码行数:11,代码来源:CashierController.php

示例9: setRequest

 /**
  * Initialize the form request with data from the given request.
  *
  * @param  Request  $request
  * @return void
  */
 public function setRequest(Request $request)
 {
     $files = $request->files->all();
     $files = is_array($files) ? array_filter($files) : $files;
     $this->initialize($request->query->all(), $request->request->all(), $request->attributes->all(), $request->cookies->all(), $files, $request->server->all(), $request->getContent());
     if ($session = $request->getSession()) {
         $this->setSession($session);
     }
     $this->setUserResolver($request->getUserResolver());
     $this->setRouteResolver($request->getRouteResolver());
 }
开发者ID:master0mind,项目名称:Lavender,代码行数:17,代码来源:FormRequest.php

示例10: postUpload

 public function postUpload(Request $request)
 {
     $file = $request->file('file');
     $token = $request->getSession()->get('access_token');
     if ($file->isValid()) {
         $uploadedFile = $this->imageRepository->create($file, $request->user());
         $this->dispatch(new PerformOcr($uploadedFile, $token));
         return json_encode(['status' => 'success']);
     }
     return json_encode(['status' => 'failed']);
 }
开发者ID:phpfour,项目名称:bangla-ocr,代码行数:11,代码来源:ImageController.php

示例11: decorate

 public function decorate(Request $current)
 {
     $files = $current->files->all();
     $files = is_array($files) ? array_filter($files) : $files;
     $this->initialize($current->query->all(), $current->request->all(), $current->attributes->all(), $current->cookies->all(), $files, $current->server->all(), $current->getContent());
     if ($session = $current->getSession()) {
         $this->setSession($session);
     }
     $this->setUserResolver($current->getUserResolver());
     $this->setRouteResolver($current->getRouteResolver());
     $this->originalRequest = $current;
 }
开发者ID:realholgi,项目名称:cmsable,代码行数:12,代码来源:ReplicateRequest.php

示例12: callback

 public function callback(Request $request, $provider)
 {
     $openid = Socialite::with($provider)->user();
     User::bind($openid, $provider);
     $url = parse_url($request->getSession()->pull('auth_redirect'));
     $url['query'] = ($url['query'] ? '&' : '') . "email={$openid->email}&token={$openid->token}";
     return redirect("{$url['scheme']}://{$url['host']}{$url['path']}?{$url['query']}");
     // return redirect(, [
     //     'email'=>$openid->getEmail(),
     //     'token'=>$openid->token
     // ], HTTP_URL_JOIN_QUERY));
 }
开发者ID:kshar1989,项目名称:dianpou,代码行数:12,代码来源:AuthController.php

示例13: index

 /**
  * @param \Coyote\Forum $forum
  * @param Request $request
  * @return $this
  */
 public function index($forum, Request $request)
 {
     // builds breadcrumb for this category
     $this->breadcrumb($forum);
     // create view with online users
     $viewers = app()->make('Session\\Viewers')->render($request->getRequestUri());
     $this->pushForumCriteria();
     $forumList = $this->forum->forumList();
     $this->topic->pushCriteria(new BelongsToForum($forum->id));
     $topics = $this->topic->paginate(auth()->id(), $request->getSession()->getId());
     // let's cache tags. we don't need to run this query every time
     $tags = Cache::remember('forum:tags', 60 * 24, function () {
         return $this->forum->getTagClouds();
     });
     return parent::view('forum.category')->with(compact('viewers', 'forumList', 'forum', 'topics', 'tags'));
 }
开发者ID:furious-programming,项目名称:coyote,代码行数:21,代码来源:CategoryController.php

示例14: postListing

 public function postListing(Request $request)
 {
     $data = $request->all();
     // Create listing
     $listing = \App\Listing::create(['address1' => $data['address1'], 'address2' => $data['address2'], 'city' => $data['city'], 'state' => $data['state'], 'zip' => $data['zip'], 'property_type' => $data['property_type'], 'condition' => $data['condition'], 'beds' => $data['beds'], 'baths' => $data['baths'], 'additional_rooms' => $data['additional_rooms'], 'approx_size' => $data['approx_size'], 'approx_age_of_kitchen' => $data['approx_age_of_kitchen'], 'approx_age_of_baths' => $data['approx_age_of_baths'], 'message' => $data['message'], 'first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'email' => $data['email'], 'phone' => $data['phone']]);
     $userData = $this->mapData($data);
     $checkForUser = \App\User::where('email', '=', $userData['email'])->first();
     if (is_null($checkForUser)) {
         // Create User
         $user = \App\User::create(['name' => $userData['name'], 'email' => $userData['email'], 'password' => bcrypt($userData['password']), 'phone' => $userData['phone']]);
     }
     $email = 'emails.listingPost';
     $data['name'] = $userData['name'];
     $this->mailIt($email, $data);
     dd($request->getSession());
     return redirect()->back()->with('success_message', 'Your listing has been sent for review...');
 }
开发者ID:SapioBeasley,项目名称:jacobsgroupvegas.com,代码行数:17,代码来源:ContactsController.php

示例15: getToken

 /**
  * Get the token credentials for the request.
  *
  * @return \League\OAuth1\Client\Credentials\TokenCredentials
  */
 protected function getToken()
 {
     $temp = $this->request->getSession()->get('oauth.temp');
     return $this->server->getTokenCredentials($temp, $this->request->get('oauth_token'), $this->request->get('oauth_verifier'));
 }
开发者ID:andreoav,项目名称:socialite,代码行数:10,代码来源:AbstractProvider.php


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