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


PHP Cookie\CookieJar類代碼示例

本文整理匯總了PHP中Illuminate\Cookie\CookieJar的典型用法代碼示例。如果您正苦於以下問題:PHP CookieJar類的具體用法?PHP CookieJar怎麽用?PHP CookieJar使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CookieJar $cookieJar, Request $request)
 {
     if ($request->isMethod('post')) {
         $supplier_email = $request->get('supplier_email');
         $supplier_password = $request->get('supplier_password');
         $checkAgentExists = Supplier::where("email", "=", $supplier_email);
         $checkAgentExists = $checkAgentExists->where("password", "=", md5($supplier_password . Config::get('constants.SITENAME')));
         $checkAgentExists = $checkAgentExists->get();
         if ($request->get('remember_login')) {
             $cookieJar->queue(Cookie::make('supplier_email', $supplier_email, 60));
             $cookieJar->queue(Cookie::make('supplier_password', $supplier_password, 60));
         } else {
             $cookieJar->queue(Cookie::forget('supplier_email'));
             $cookieJar->queue(Cookie::forget('supplier_password'));
         }
         if (count($checkAgentExists) > 0) {
             Session::put('SUPPLIER_ACCESS_ID', $checkAgentExists[0]->id);
             Session::put('SUPPLIER_ACCESS_FNAME', $checkAgentExists[0]->first_name);
             Session::put('SUPPLIER_ACCESS_LNAME', $checkAgentExists[0]->last_name);
             return redirect('supplier/dashboard');
         } else {
             return Redirect::route('supplier_land')->with('message', ['Invalid email address or/and password.']);
         }
     }
 }
開發者ID:kalyandey,項目名稱:livingadventure,代碼行數:31,代碼來源:LoginController.php

示例2: skip

 /**
  * @param Request $request
  * @param CookieJar $cookie
  * @return \Illuminate\Http\RedirectResponse
  */
 public function skip(Request $request, CookieJar $cookie)
 {
     if ($request->get('skip', false)) {
         $cookie->queue(cookie('intro', 'skipped'));
     }
     return redirect()->route('home');
 }
開發者ID:SkysoulDesign,項目名稱:TempArk,代碼行數:12,代碼來源:HomeController.php

示例3: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app['cookie'] = $this->app->share(function ($app) {
         $cookies = new CookieJar($app['request'], $app['encrypter']);
         $config = $app['config']['session'];
         return $cookies->setDefaultPathAndDomain($config['path'], $config['domain']);
     });
 }
開發者ID:lenninsanchez,項目名稱:donadores,代碼行數:13,代碼來源:CookieServiceProvider.php

示例4: tambahpoll

 public function tambahpoll(CookieJar $cookieJar, Request $request)
 {
     $input = $request->except('_token');
     $update = Models\Jawaban::where('id_soal_poll', $input['id_soal_poll'])->where('jawaban', $input['jawaban'])->first();
     $update->counter = $update->counter + 1;
     $update->update();
     $cookieJar->queue(cookie('polling', 'sudah', 45000));
     return redirect()->to('lihatpoll');
 }
開發者ID:zigunx,項目名稱:sis-DEV_old,代碼行數:9,代碼來源:FrontController.php

示例5: login

 public function login(\Illuminate\Cookie\CookieJar $cookieJar, \Request $request)
 {
     // Replace 1234 with your APP_ID
     // Replace 123456789 with your APP_SECRET
     FacebookSession::setDefaultApplication('1234', '123456789');
     $helper = new FacebookRedirectLoginHelper(\Request::url());
     if ($session = $helper->getSessionFromRedirect()) {
         $request = new FacebookRequest($session, 'GET', '/me');
         $userData = $request->execute()->getGraphObject(GraphUser::className());
         $cookieJar->queue(cookie('access_token', $session->getAccessToken(), 45000));
     }
     return redirect($helper->getLoginUrl());
 }
開發者ID:Jimtonik,項目名稱:laravel5-facebook-php-sdk-4-wrapper,代碼行數:13,代碼來源:FacebookController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(CookieJar $cookieJar, Request $request)
 {
     if (Session::has('ADMIN_ACCESS_ID')) {
         return redirect('admin/dashboard');
     }
     if ($request->isMethod('post')) {
         $admin_email = $request->get('admin_email');
         $admin_password = $request->get('admin_password');
         $checkAgentExists = Admin::where("email", "=", $admin_email);
         $checkAgentExists = $checkAgentExists->get();
         if ($request->get('remember_login')) {
             $cookieJar->queue(Cookie::make('admin_email', $admin_email, 60));
             $cookieJar->queue(Cookie::make('admin_password', $admin_password, 60));
         } else {
             $cookieJar->queue(Cookie::forget('admin_email'));
             $cookieJar->queue(Cookie::forget('admin_password'));
         }
         if (count($checkAgentExists) > 0) {
             if (Hash::check($admin_password, $checkAgentExists[0]->password)) {
                 Session::put('ADMIN_ACCESS_ID', $checkAgentExists[0]->id);
                 Session::put('ADMIN_ACCESS_FNAME', $checkAgentExists[0]->first_name);
                 Session::put('ADMIN_ACCESS_LNAME', $checkAgentExists[0]->last_name);
                 return redirect::route('dashboard');
             } else {
                 return redirect::route('admin')->with('errorMessage', 'Invalid password provided.');
             }
         } else {
             return redirect::route('admin')->with('errorMessage', 'Invalid email address or/and password provided.');
         }
     }
     $data = array();
     $data['admin_email'] = '';
     $data['admin_password'] = '';
     $admin_email = Cookie::get('admin_email');
     $admin_password = Cookie::get('admin_password');
     if ($admin_email && $admin_password) {
         $data['admin_email'] = $admin_email;
         $data['admin_password'] = $admin_password;
     }
     return view('admin/login', $data);
 }
開發者ID:kalyandey,項目名稱:livingadventure,代碼行數:46,代碼來源:LoginController.php

示例7: getQueuedCookies

 /**
  * Get the cookies which have been queued for the next request.
  *
  * @return array 
  * @static 
  */
 public static function getQueuedCookies()
 {
     return \Illuminate\Cookie\CookieJar::getQueuedCookies();
 }
開發者ID:satriashp,項目名稱:tour,代碼行數:10,代碼來源:_ide_helper.php

示例8: getCookie

 /**
  * Write the session cookie to the response.
  *
  * @param  Illuminate\Cookie\CookieJar  $cookie
  * @param  string  $name
  * @param  int  $lifetime
  * @return void
  */
 public function getCookie(CookieJar $cookie, $name, $lifetime)
 {
     return $cookie->make($name, $this->getSessionId(), $lifetime);
 }
開發者ID:defra91,項目名稱:levecchiecredenze.it,代碼行數:12,代碼來源:Store.php

示例9: __construct

 public function __construct(CookieJar $cookieJar, Request $request)
 {
     $cookieJar->queue(cookie('hasSeenCookieNotice', 157680000));
     parent::__construct();
 }
開發者ID:WendyMcF,項目名稱:Sidequest,代碼行數:5,代碼來源:StaticPageController.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $response = $next($request);
     foreach ($this->cookies->getQueuedCookies() as $cookie) {
         $response->headers->setCookie($cookie);
     }
     return $response;
 }
開發者ID:scrobot,項目名稱:Lumen,代碼行數:15,代碼來源:AddQueuedCookiesToResponse.php

示例11: handle

 /**
  * Handle the given request and get the response.
  *
  * @implements HttpKernelInterface::handle
  *
  * @param  \Symfony\Component\HttpFoundation\Request  $request
  * @param  int   $type
  * @param  bool  $catch
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
 {
     $response = $this->app->handle($request, $type, $catch);
     foreach ($this->cookies->getQueuedCookies() as $cookie) {
         $response->headers->setCookie($cookie);
     }
     return $response;
 }
開發者ID:GeorgeBroadley,項目名稱:caffeine-vendor,代碼行數:18,代碼來源:Queue.php

示例12: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (php_sapi_name() == 'cli' || !INSTALLED) {
         return $next($request);
     }
     $lastUpdate = $request->cookie('last_visit');
     if (!$lastUpdate || $lastUpdate->day != Carbon::now()->day) {
         $this->stat->increment('visits');
         $cookie = $this->cookieJar->forever('last_visit', Carbon::now());
         $this->cookieJar->queue($cookie);
     }
     return $next($request);
 }
開發者ID:vjaykoogu,項目名稱:smile-media-laravel,代碼行數:20,代碼來源:RequestTracker.php

示例13: setCookie

 /**
  * Set the cookies
  *
  * @return $this
  */
 protected function setCookie($remember_me = false)
 {
     if (config('laravel-avp.cookie_age') == 'forever') {
         // Set a forever cookie saying the user is old enough
         $cookie = $this->cookie->forever(config('laravel-avp.cookie_name'), config('laravel-avp.cookie_val'));
     } elseif ($remember_me) {
         // Remember for 30 days
         $cookie = $this->cookie->make(config('laravel-avp.cookie_name'), config('laravel-avp.cookie_val'), 60 * 24 * 30);
     } elseif (is_int(config('laravel-avp.cookie_age'))) {
         // Sets a cookie lasting X minutes saying the user is old enough
         $cookie = $this->cookie->make(config('laravel-avp.cookie_name'), config('laravel-avp.cookie_val'), config('laravel-avp.cookie_age'));
     } else {
         // Sets a session cookie saying the user is old enough
         $cookie = $this->cookie->make(config('laravel-avp.cookie_name'), config('laravel-avp.cookie_val'));
     }
     return redirect()->intended('/')->withCookie($cookie);
 }
開發者ID:fastwebmedia,項目名稱:laravel-avp,代碼行數:22,代碼來源:Validation.php

示例14: forget

 /**
  * {@inheritDoc}
  */
 public function forget()
 {
     $cookie = $this->jar->forget($this->key);
     $this->jar->queue($cookie);
 }
開發者ID:kevin416,項目名稱:admin,代碼行數:8,代碼來源:IlluminateCookie.php

示例15: destroy

 /**
  * {@inheritDoc}
  */
 public function destroy($sessionId)
 {
     $this->cookie->queue($this->cookie->forget($sessionId));
 }
開發者ID:rodrigopbel,項目名稱:ong,代碼行數:7,代碼來源:CookieSessionHandler.php


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