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


PHP Session::pull方法代碼示例

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


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

示例1: addProduct

 public function addProduct($id, $num)
 {
     if (Request::ajax()) {
         if (Session::has("cart")) {
             $cart = Session::get("cart");
             $check = array_key_exists($id, $cart);
             //kiem tra san pham da co trong gio chua
             if ($check) {
                 //roi thi tra ve
                 $result = "Sản phẩm đã có trong giỏ hàng";
                 return json_encode(["result" => $result]);
             } else {
                 //chua thi them san pham
                 $product = [$id => $num];
                 $cart = Session::pull("cart");
                 $cart += $product;
                 Session::put("cart", $cart);
                 $result = "Thêm giỏ hàng thành công";
                 $tsl = countProducts();
                 return json_encode(["result" => $result, "tsl" => $tsl]);
             }
         } else {
             //chua ton tai session gio hang
             $product = [$id => $num];
             Session::put("cart", $product);
             $tsl = $num;
             $result = "Thêm giỏ hàng thành công";
             return json_encode(["result" => $result, "tsl" => $tsl]);
         }
     } else {
         return redirect("/");
     }
 }
開發者ID:thiennhan2310,項目名稱:maimallshop,代碼行數:33,代碼來源:CartController.php

示例2: handle

 /**
  * Handle the report append command.
  *
  * @param \Gitamin\Commands\Identity\AddIdentityCommand $command
  *
  * @return \Gitamin\Models\Identity
  */
 public function handle(AddIdentityCommand $command)
 {
     $data = ['user_id' => $command->userId, 'extern_uid' => $command->data['extern_uid'], 'provider_id' => $command->data['provider_id'], 'nickname' => $command->data['nickname'], 'created_at' => Carbon::now()->toDateTimeString()];
     // Create the identify
     $identify = Identity::create($data);
     Session::pull('connect_data');
     return $identify;
 }
開發者ID:gitaminhq,項目名稱:gitamin,代碼行數:15,代碼來源:AddIdentityCommandHandler.php

示例3: postTwoFactor

 /**
  * Validates the Two Factor token.
  *
  * This feels very hacky, but we have to juggle authentication and codes.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postTwoFactor()
 {
     // Check that we have a session.
     if ($userId = Session::pull('2fa_id')) {
         $code = Binput::get('code');
         // Maybe a temp login here.
         Auth::loginUsingId($userId);
         $valid = Google2FA::verifyKey(Auth::user()->google_2fa_secret, $code);
         if ($valid) {
             return Redirect::intended('dashboard');
         } else {
             // Failed login, log back out.
             Auth::logout();
             return Redirect::route('auth.login')->withError(trans('forms.login.invalid-token'));
         }
     }
     return Redirect::route('auth.login')->withError(trans('forms.login.invalid-token'));
 }
開發者ID:guduchango,項目名稱:Cachet,代碼行數:25,代碼來源:AuthController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     if (Session::has('user_instagram_info')) {
         $rules = array('firstname' => 'required', 'surname' => 'required', 'shopname' => 'required', 'shopemail' => 'required|email', 'pass' => 'required', 'repass' => 'required|same:pass');
         // do the validation ----------------------------------
         // validate against the inputs from our form
         $validator = Validator::make($request->all(), $rules);
         // check if the validator failed -----------------------
         if ($validator->fails()) {
             // get the error messages from the validator
             $messages = $validator->messages();
             // redirect our user back to the form with the errors from the validator
             return back()->withInput()->withErrors($messages);
         } else {
             $instagramInfo = Session::pull('user_instagram_info');
             $user = new User();
             $user->name = $request->input('firstname');
             $user->surname = $request->input('surname');
             $user->setAsSupplier();
             $user->is_active = false;
             $user->email = $request->input('shopemail');
             $user->password = bcrypt($request->input('pass'));
             $user->save();
             $supplier = new Supplier();
             $supplier->id = $user->id;
             $supplier->shop_name = $request->input('shopname');
             $supplier->profile_image = $instagramInfo->user->profile_picture;
             $supplier->save();
             $instagramAccount = new InstagramAccount();
             $instagramAccount->instagram_id = $instagramInfo->user->id;
             $instagramAccount->username = $instagramInfo->user->username;
             $instagramAccount->access_token = $instagramInfo->access_token;
             $instagramAccount->full_name = $instagramInfo->user->full_name;
             $instagramAccount->bio = $instagramInfo->user->bio;
             $instagramAccount->website = $instagramInfo->user->website;
             $instagramAccount->profile_picture = $instagramInfo->user->profile_picture;
             $supplier->instagramAccount()->save($instagramAccount);
             Storage::makeDirectory($user->id);
             return redirect()->action('AuthenticationController@showRegister')->with('success', ['Successful']);
         }
     } else {
         return redirect()->action('AuthenticationController@showRegister');
     }
 }
開發者ID:mg9,項目名稱:koalaBazaar,代碼行數:50,代碼來源:SupplierController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $rules = array('firstname' => 'required', 'surname' => 'required', 'customeremail' => 'required|email', 'pass' => 'required', 'phone' => 'required', 'rpass' => 'required|same:pass');
     $validator = Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         // get the error messages from the validator
         $messages = $validator->messages();
         // redirect our user back to the form with the errors from the validator
         return back()->withInput()->withErrors($messages);
     } else {
         if (User::where('email', $request->input('customeremail'))->first()) {
             return redirect()->action('AuthenticationController@showRegister')->withErrors(['messages' => "Sistemde mail adresi kayıtlı"]);
         }
         $user = new User();
         $user->name = trim($request->input('firstname'));
         $user->surname = trim($request->input('surname'));
         $user->setAsCustomer();
         $user->is_active = false;
         $user->email = $request->input('customeremail');
         $user->password = bcrypt($request->input('pass'));
         $user->save();
         $customer = new Customer();
         $customer->phone = $request->input('phone');
         $customer->id = $user->id;
         $customer->save();
         if (Session::has('user_instagram_info')) {
             $instagramInfo = Session::pull('user_instagram_info');
             $instagramAccount = new InstagramAccount();
             $instagramAccount->instagram_id = $instagramInfo->user->id;
             $instagramAccount->username = $instagramInfo->user->username;
             $instagramAccount->access_token = $instagramInfo->access_token;
             $instagramAccount->full_name = $instagramInfo->user->full_name;
             $instagramAccount->bio = $instagramInfo->user->bio;
             $instagramAccount->website = $instagramInfo->user->website;
             $instagramAccount->profile_picture = $instagramInfo->user->profile_picture;
             $customer->instagramAccount()->save($instagramAccount);
         }
         Storage::makeDirectory($user->id);
         return redirect()->action('AuthenticationController@showRegister')->with('success', ['Successful']);
     }
 }
開發者ID:mg9,項目名稱:koalaBazaar,代碼行數:47,代碼來源:CustomerController.php

示例6: create

 /**
  * Show the form for creating a single new user.
  * @return Response
  */
 public function create()
 {
     // Check to see if we have been given a summary from the bulk add process.
     // If this is the case then render the results view instead of the form.
     $results = Session::pull('bulkResults');
     if ($results) {
         return View::make('users.bulk_summary')->with('results', $results);
     } else {
         return View::make('users.create');
     }
 }
開發者ID:backstagetechnicalservices,項目名稱:website,代碼行數:15,代碼來源:UsersController.php

示例7: removeFromComparison

 public function removeFromComparison($property)
 {
     $modified = array_diff(Session::pull('properties_in_comparison', []), [$property->id]);
     Session::put('properties_in_comparison', $modified);
 }
開發者ID:yohanes1989,項目名稱:goprop,代碼行數:5,代碼來源:PropertyCompareHelper.php

示例8: store


//.........這裏部分代碼省略.........
                         }
                         //pr($res);
                         $i++;
                     }
                     //pr($res);
                     $count = [];
                     if (isset($res['update_prod'])) {
                         $count['update_prod'] = count($res['update_prod']);
                     }
                     if (isset($res['add_prod'])) {
                         $count['add_prod'] = count($res['add_prod']);
                     }
                     if (isset($res['add_to_GK'])) {
                         $count['add_to_GK'] = count($res['add_to_GK']);
                     }
                     if (isset($res['add_to_TV'])) {
                         $count['add_to_TV'] = count($res['add_to_TV']);
                     }
                     if (isset($res['add_to_MK'])) {
                         $count['add_to_MK'] = count($res['add_to_MK']);
                     }
                     if (isset($res['update_purch'])) {
                         $count['update_purch'] = count($res['update_purch']);
                     }
                     if (isset($res['add_purch'])) {
                         $count['add_purch'] = count($res['add_purch']);
                     }
                     Session::put('count', $count);
                     Session::put('res', $res);
                     //pr($res);
                     $cloudModel->addFile('import', $filename, $real_filename);
                     return redirect()->route('cloud.index');
                 }
             } else {
                 Session::flash('message', GetMessages("ERROR_NO_CSV_FILE"));
                 return redirect()->route('cloud.index');
             }
         } else {
             Session::flash('message', GetMessages("ERROR_NO_CSV_FILE"));
             return redirect()->route('cloud.index');
         }
     }
     if (isset($_POST['end_import'])) {
         if (!right('Import')) {
             abort(404);
         }
         $count = Session::pull('count', null);
         $res = Session::pull('res', null);
         //pr($res);
         //pr($count);
         if (isset($res['update_prod']) and count($res['update_prod']) > 0) {
             $productModel->updatingListProducts($res['update_prod']);
         }
         if (isset($res['add_prod']) and count($res['add_prod']) > 0) {
             $idsNewProducts = $productModel->createProducts($res['add_prod']);
             Session::put('idsNewProducts', $idsNewProducts);
         }
         if (isset($res['add_to_GK']) and count($res['add_to_GK']) > 0) {
             $productModel->addsToSite($res['add_to_GK'], 'GK');
         }
         if (isset($res['add_to_TV']) and count($res['add_to_TV']) > 0) {
             $productModel->addsToSite($res['add_to_TV'], 'TV');
         }
         if (isset($res['add_to_MK']) and count($res['add_to_MK']) > 0) {
             $productModel->addsToSite($res['add_to_MK'], 'MK');
         }
         if (isset($res['update_purch']) and count($res['update_purch']) > 0) {
             $purchaseModel->updatePurchase($res['update_purch']);
         }
         if (isset($res['add_purch']) and count($res['add_purch']) > 0) {
             $purchaseModel->addPurchases($res['add_purch']);
         }
         $historyModel->saveHistory('import', $count);
         Session::flash('message', GetMessages("SUCCESS_IMPORT_COMPLETED"));
         return redirect()->route('cloud.index');
     }
     if (isset($_POST['send_to_site'])) {
         if (!right('Import')) {
             abort(404);
         }
         //pr($_POST);
         if (isset($_POST['sent_to_'])) {
             $externalModel = new External();
             if (isset($_POST['sent_to_']['GK'])) {
                 $externalModel->send('GK');
             }
             if (isset($_POST['sent_to_']['TV'])) {
                 $externalModel->send('TV');
             }
             if (isset($_POST['sent_to_']['GK'])) {
                 $externalModel->send('MK');
             }
         }
         if (isset($_POST['clear_list'])) {
             $productModel->deleteAllExport();
         }
         Session::flash('message', GetMessages("SUCCESS_EXTERNAL_EXPORT"));
         return redirect()->route('cloud.index');
     }
 }
開發者ID:enotsokolov,項目名稱:vp_plus,代碼行數:101,代碼來源:CloudController.php

示例9: getIndex

 /**
  * Renders index page for the settings
  * 
  * @return Response
  */
 public function getIndex()
 {
     $settings = Settings::getAll();
     $locales = Settings::getLocales();
     return view('admin.settings.index', ['settings' => $settings, 'locales' => $locales, 'settings_tab' => Session::pull('settings_tab')]);
 }
開發者ID:ambarsetyawan,項目名稱:Laravel5Starter,代碼行數:11,代碼來源:AdminSettingsController.php

示例10: callback

 public function callback(Request $request)
 {
     if (Session::get('instagram_operation')) {
         $instagramOperation = Session::pull('instagram_operation');
         if ($instagramOperation['operation'] == 'login') {
             if ($request->get('code')) {
                 $code = $request->get('code');
                 $instagram = new InstagramAPI();
                 $data = $instagram->getOAuthToken($code);
                 $instagramAccount = InstagramAccount::where(['username' => $data->user->username, 'access_token' => $data->access_token])->first();
                 if ($instagramAccount) {
                     if (Auth::loginUsingId($instagramAccount->instagramable->user->id)) {
                         if ($instagramAccount->instagramable->user->isSupplier()) {
                             return redirect()->action('Dashboard\\SupplierController@show');
                         }
                         if ($instagramAccount->instagramable->user->isCustomer()) {
                             return redirect()->action('Dashboard\\CustomerController@show');
                         }
                     }
                 } else {
                     return redirect()->action('AuthenticationController@showRegister')->withErrors(['messages' => "Kayıtlı Kullanıcı Bulunamadı"]);
                 }
             }
         }
         if ($instagramOperation['operation'] == 'register') {
             if ($instagramOperation['user_type'] == 'supplier') {
                 if (Session::has('user_instagram_info')) {
                     Session::forget('user_instagram_info');
                 }
                 if ($request->get('code')) {
                     $code = $request->get('code');
                     $instagram = new InstagramAPI();
                     $data = $instagram->getOAuthToken($code);
                     Session::put('user_instagram_info', $data);
                     return Redirect::action('Dashboard\\SupplierController@create');
                 }
             }
             if ($instagramOperation['user_type'] == 'customer') {
                 if (Session::has('user_instagram_info')) {
                     Session::forget('user_instagram_info');
                 }
                 if ($request->get('code')) {
                     $code = $request->get('code');
                     $instagram = new InstagramAPI();
                     $data = $instagram->getOAuthToken($code);
                     Session::put('user_instagram_info', $data);
                     return Redirect::action('Dashboard\\CustomerController@create');
                 }
             }
         }
     }
 }
開發者ID:mg9,項目名稱:koalaBazaar,代碼行數:52,代碼來源:InstagramController.php

示例11: processConnect

 /**
  * Process the response from a provider connect attempt.
  *
  * @param string                                $provider
  * @param \OAuth\Common\Service\AbstractService $service
  * @param array                                 $access_token
  * 
  * @return Redirect
  */
 protected function processConnect($provider, $service, $access_token)
 {
     $user_info_callback = Config::get('laravel-social::providers.' . strtolower($provider) . '.fetch_user_info');
     if (empty($user_info_callback) || !$user_info_callback instanceof Closure) {
         return Redirect::to(Session::pull('mmanos.social.onerror', '/'))->with(Config::get('laravel-social::error_flash_var'), 'There was a problem connecting your account (6).');
     }
     try {
         $user_info = $user_info_callback($service);
     } catch (Exception $e) {
     }
     if (empty($user_info) || !is_array($user_info)) {
         return Redirect::to(Session::pull('mmanos.social.onerror', '/'))->with(Config::get('laravel-social::error_flash_var'), 'There was a problem connecting your account (7).');
     }
     if (empty($user_info['id'])) {
         return Redirect::to(Session::pull('mmanos.social.onerror', '/'))->with(Config::get('laravel-social::error_flash_var'), 'There was a problem connecting your account (8).');
     }
     $provider_id = array_get($user_info, 'id');
     $user_provider = Provider::where('provider', strtolower($provider))->where('provider_id', $provider_id)->first();
     if ($user_provider) {
         if ($user_provider->user_id != Auth::id()) {
             return Redirect::to(Session::pull('mmanos.social.onerror', '/'))->with(Config::get('laravel-social::error_flash_var'), 'There was a problem connecting your account (9).');
         }
         $user_provider->access_token = $access_token;
         $user_provider->save();
     } else {
         $this->linkProvider(Auth::id(), $provider, $provider_id, $access_token);
     }
     return Redirect::to(Session::pull('mmanos.social.onsuccess', '/'))->with(Config::get('laravel-social::success_flash_var'), 'You have successfully connected your account.');
 }
開發者ID:mmanos,項目名稱:laravel-social,代碼行數:38,代碼來源:SocialController.php

示例12: logout

 public function logout()
 {
     $post_data = array();
     $post_data['ComToken'] = Session::pull('ComToken');
     $post_data['Logout'] = Session::pull('AuthToken');
     $response = $this->curlRequest($post_data);
     Session::flush();
     $this->loggedOut = true;
 }
開發者ID:ckylape,項目名稱:oauth-with-db,代碼行數:9,代碼來源:OAuthWithDatabaseGuard.php

示例13: profile

 public function profile($user_name = null)
 {
     if (trim($user_name) == "") {
         if (Session::has('user')) {
             $aUser = Session::pull('user');
             $aCharacters = Character::where('user_id', $aUser['id'])->get()->toArray();
             /*if(count($aCharacters) == 0){
                   return view('users.users.show')->with('characters', $aCharacters);
               }*/
             return view('users.users.show')->with('characters', $aCharacters);
         } else {
             return redirect('user');
         }
     } else {
     }
 }
開發者ID:captainbuggythefifth,項目名稱:social-media-dating,代碼行數:16,代碼來源:CharactersController.php

示例14: check

 public function check($captcha = null, $sessionName = '_captcha')
 {
     return Session::pull($sessionName) === strtoupper($captcha);
 }
開發者ID:tsoftware-org,項目名稱:captcha,代碼行數:4,代碼來源:Captcha.php

示例15: DeleteProductFromBasket

 public function DeleteProductFromBasket($id, $model)
 {
     $ids = array();
     foreach (Session::pull("basketProducts") as $product) {
         if ($product[0] == $id && $product[1] == $model) {
             continue;
         }
         array_push($ids, array($product[0], $product[1]));
     }
     Session::put("basketProducts", $ids);
     return "success";
 }
開發者ID:snaksa,項目名稱:MakeupAtelierBulgaria,代碼行數:12,代碼來源:ProductsController.php


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