How can I do that in the model so that every time I access the records from the model discounted price is calculated?

|
GunnerBen 2021-03-26 07:35:00
What is wrong with that botton
Rashid 2021-03-26 08:25:38
if (Session::has(‘cart_items’)) {

$cart = session()->get(‘cart_items’);

foreach ($cart as $key => $value) {
if ($cart[$key][‘product_id’] == $id) {

$value[‘quantity’] += 1;
return $cart[$key][‘quantity’];
// return session()->get(‘cart_items’);
}
}
}
Session::push(‘cart_items’, [‘product_id’ => $id, ‘quantity’ => 1]);
return session()->get(‘cart_items’);

Rashid 2021-03-26 08:25:56
why my cart quantity updation not work
hddhagai 2021-03-26 08:29:42
Rashid 2021-03-24 18:02:33
I need to calculate price after discount each time I access my model Product. There are fields to store price and discount but no final price after discount. How can I do that in the model so that every time I access the records from the model discounted price is calculated?

Use accessors

Relaxed Guy 2021-03-26 09:35:48
Guys
Joice 2021-03-26 09:43:45
laravel_discuss-74582.jpg

Joice 2021-03-26 09:43:57
Anybody know why this error coming
themanojyadav 2021-03-26 09:44:36
Your array is empty or null.
Joice 2021-03-26 09:45:03
Which array
Joice 2021-03-26 09:45:14
Just cloned a project
Joice 2021-03-26 09:45:25
And no commands are working
themanojyadav 2021-03-26 09:45:34
Have you imported the database
Joice 2021-03-26 09:46:03
themanojyadav 2021-03-26 09:45:34
Have you imported the database

Nope ..but it shouldn’t be a reason

Joice 2021-03-26 09:46:22
Without importing db it should work right?
themanojyadav 2021-03-26 09:47:10
i guess it is getting some data from database. Thats why it is giving the error in array of null
Joice 2021-03-26 09:47:12
Php artisan is not working
Joice 2021-03-26 09:47:24
I didn’t import db
2021-03-26 10:09:18
laravel_discuss-74594.jpg

2021-03-26 10:09:29
This is my mail template unfortunately the condition isn’t work
2021-03-26 10:09:39
Plz help me
2021-03-26 10:10:17
I have colum in my database named w_status
2021-03-26 10:10:40
It had values like 0, 1 2 3 4
2021-03-26 10:11:15
So the value changes I need to sent a email to my customer email
2021-03-26 10:11:42
Email sending successfully
2021-03-26 10:11:57
But the condition isn’t working
shin_u_s 2021-03-26 11:09:30
Could not open input file :artisan
shin_u_s 2021-03-26 11:09:42
Any solution ?
sobirjonovs 2021-03-26 11:10:49
shin_u_s 2021-03-26 11:09:42
Any solution ?

composer install

shin_u_s 2021-03-26 11:11:36
Yes installed
sobirjonovs 2021-03-26 11:12:53
shin_u_s 2021-03-26 11:11:36
Yes installed

I meant composer packages are not installed

shin_u_s 2021-03-26 11:13:02
When I run the command composer require encore/laravel admin
sobirjonovs 2021-03-26 11:13:31
sobirjonovs 2021-03-26 11:12:53
I meant composer packages are not installed

or you are not in the project folder

shin_u_s 2021-03-26 11:14:07
It shows root package ‘encore/laravel/admin’ cannot require itself in its composer.json
shin_u_s 2021-03-26 11:16:15
sobirjonovs 2021-03-26 11:13:31
or you are not in the project folder

Yes I’m in project folder

sobirjonovs 2021-03-26 11:16:44
shin_u_s 2021-03-26 11:16:15
Yes I’m in project folder

take a screenshot of your current state

|