#### Category : laravel-session

I would like to change the Laravel Session Driver. The application is already up and running. There is a helper class with getters and setters and modifiers that accesses the session. My question How do I change the driver from cookie to database? What is the correct procedure to change the session driver from cookie ..

I switched to database driver for Session and migrated the table. I’ve noticed that even after the logout action, the value last_activity in the table keeps getting updated after every refresh, even if the user isn’t logged-in anymore. I’ve tried removing it from the records of the database, but once the user refreshs at the ..

I’m working with Laravel 5.8 and in this project, I want to insert a session value into the DB: if(session(‘video-products’)){ UserVideo::create([ ‘user_id’ => auth()->user()->usr_id, ‘product_id’ => session(‘video-products’), ‘order_id’ => $orderId, ]); } But it does not work out and inserts nothing. And when I dd(session(‘video-products’)), I get this: array:1 [▼ 0 => 33 ] And .. Read more I’m using Laravel 5.8 to build my Online Store and in this Online Store there are two types of products. Physical products such as (books, magazines & etc) and Video type products. Now I need to determine that if a user has added a Video type product and ALSO a Physical product to his Shopping .. Read more I’m making an Online Store with Laravel 5.8 and in this project I have some Video products to sell and also some physical products (such as books, magazines and etc) to sell. Now I want to make a session, when user has added a Video product and also added a Physical product to his Shopping .. Read more I’m making an Online Store with Laravel 5.8 and in this project I have some video products to sell and also some physical products (such as books, magazines and etc) to sell. Basically if user adds Physical products to his Shopping Cart, at the next request he has to select the Delivery Type for sending .. Read more I have a Controller method like this: public function chargeWallet(Request$request, $wallet,$user) { try { $data =$request->validate([ ‘charge’ => ‘required|integer|min:1000’, ]); $payment = Payment::create([ ‘pay_type_id’ => ‘191’, ‘pay_date’ => jdate()->format(‘Y/m/d’), ‘pay_amount’ =>$data[‘charge’] * 10, ‘pay_ord_id’ => ”, ‘pay_status_id’ => ‘181’, ‘pay_creator_id’ => auth()->user()->usr_id, ]); $request->session()->flash(‘charge_wallet’,$wallet); // Setting Session $sendInformation = new BankGateWay($payment->pay_id, ..

I have a Controller method like this: public function chargeWallet(Request $request,$wallet, $user) { try {$data = $request->validate([ ‘charge’ => ‘required|integer|min:1000’, ]);$payment = Payment::create([ ‘pay_type_id’ => ‘191’, ‘pay_date’ => jdate()->format(‘Y/m/d’), ‘pay_amount’ => $data[‘charge’] * 10, ‘pay_ord_id’ => ”, ‘pay_status_id’ => ‘181’, ‘pay_creator_id’ => auth()->user()->usr_id, ]);$request->session()->flash(‘charge_wallet’,$wallet); // Setting Session$sendInformation = new BankGateWay($payment->pay_id, .. Read more I’m working on an Online Store project using Laravel 5.8. And I have added this method for sending the user to bank gateway in order to pay the price of the bill: if(($wallet_balance < $cartPrice)&&($request->pay_wallet == ‘1’)) { //Session::flash(‘wallet_choice’,$wallet_choice);$new_Balance = 0; $cartPrice =$cartPrice – $wallet_balance; if (!empty($order)) { if ($order->ord_total > 0) { .. Read more I have created a Laravel application. After successful login to an account, Laravel makes two cookies which are Laravel_session and XSRF-TOKEN. When I just simply copy the Laravel_session and paste it into another browser or another computer’s browser then it opens the same account. "laravel_session" = "eyJpdiI6IjRwK0VjSDR1c0JGQU9lNDF…" Please, tell me how can I prevent it. .. Read more I have created a Laravel application. After successful login to an account, Laravel makes two cookies which are Laravel_session and XSRF-TOKEN. When I just simply copy the Laravel_session and paste it into another browser or another computer’s browser then it opens the same account. "laravel_session" = "eyJpdiI6IjRwK0VjSDR1c0JGQU9lNDF…" Please, tell me how can I prevent it. .. Read more Laravel 8 has config file configsession.php this file has 2 parameters to store driver’ => env(‘SESSION_DRIVER’, ‘file’), and ‘store’ => env(‘SESSION_STORE’, null) Both can be "apc", "dynamodb", "memcached", "redis" The only difference I see is that ‘driver’ can also be "file", "cookie", "database", "array" Please tell me what is the difference and why do we .. Read more I have submitted a session called payment at the Controller: try { if ($request->pay_wallet == ‘1’) { Session::put(‘wallet’, ‘payment’); return redirect()->back(); } }catch (Exception $e) { dd($e); } Then at the View, I tried this: @php if(session(‘wallet’)){ $us_id = Auth()->user()->usr_id;$user_wallet = AppUserWallet::where(‘user_id’, $us_id)->get(); foreach($user_wallet as $uw){ echo " <ul> <li>$uw->id</li> <li>$uw->balance</li> </ul> "; } .. Read more I am working on an Online Store project using Laravel 5.8 and in this project I have added a checkbox for checking if user wants to pay the price by his online wallet: <input class="form-check-input" type="checkbox" name="pay_wallet" value="1" id="defaultCheck2"> <label class="form-check-label small mr-3" for="defaultCheck2"> Pay with Wallet </label> Then at the Controller, I added this .. Read more I have a strange behaviour in my Laravel + Vue app. On the Checkout page there is a component that handles the payment method select, 3 radio buttons with a v-model on the paymentMethod in state with invoice initial value. data() { return { paymentMethod: ‘invoice’ } }, When the user changes the payment method .. Read more Let’s say that I’m logged in with user_id of 1 and I want to make a session for another user with user_id of 2. So at the Controller, I say:$request->session()->put(‘test’, ‘hello world!’); Now when the user with user_id of 2 logs in, it should see the message hello world because I’m checking it at ..

I have an Online Store project written in Laravel 5.8 and in this project, I have set some sessions at the Controller, like this: $delivery_types = [];$conflicting = false; if ($foundOrder != null) { foreach ($foundOrder as $key =>$value) { $product = Product::with(‘uploaded’)->wherePrdId($value->id)->select(‘*’)->first(); array_push($delivery_types,$product->prd_delivery); $prds[] = [$product, $value->quantity,$value->price ]; } ..

I’m creating a Laravel application and I’m trying to grasp the concept of the HTTP session. I noticed that I don’t really understand it on a fundamental level (e.g. what exactly happens). On the internet there isn’t much information available besides some basic stuff (getting and retrieving data, plus a few other common things). I ..

I have set a session value like this at Blade: @php if(…){ Session::put(‘sent’,’city’) }else{ Session::put(‘sent’,’country’) } @endphp And now, I need to check the sent session value at the Controller but don’t know how… So if you know, please help me out. Thanks. Sourc..

I’m working on an Online Store project, and in this project, every product has a product_delivery which can be set to one of these: city_free_delivery country_free_delivery null Then, I have wrote this at the Controller method, for getting product deliveries of products stored at the cart.blade.php: $delivery_types = [];$conflicting = false; if ($foundOrder != .. Read more I’m working with Laravel 5.8 and I want to set a session variable at cart.blade.php blade, like this: @php$conflicted = ”; @endphp @if($conflicting && ($prd[0]->prd_delivery == ‘city_free_delivery’ || $prd[0]->prd_delivery == ‘country_free_delivery’)) @php Session::put($conflicted , ‘0’) @endphp <p style="color:red;"> This product has free delivery but it can not be set because of service area conflict ..

$patient_diagnostic_cart = (array)(int)$request->test_id; $sessiondiagnostic_cart = serialize($patient_diagnostic_cart); session([‘sessiondiagnostic_cart’=>$sessiondiagnostic_cart]);$message = "Test added"; $response = [ ‘message’ =>$message, ‘test_id’ => array_values(unserialize(session(‘sessiondiagnostic_cart’))), ]; Sourc..