Category : laravel-session

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 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 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 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 ]; } ..

Read more

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 ..

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 ..

Read more