當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。