Skip to content

Tag: laravel

how to append a column to a model from a relationship laravel

i have a model and a relationship which i want to append a column from a relationship to the model so every time every where that the model is called that column from the relationship should be shown in model column . i want to sort the model by that column and the second problem is that the column is

Laravel 8 – Handle errors on PUT form request

I want to handle errors of put request like I do on POST request. Is that possible ? Because my actual solution seems don’t work. My handling errors looks like this My form code Answer you need use validate in your controller ex:

Update price column in database laravel

I am trying to pass along updated pricing to my orders table but am getting an error: In my controller I have this: The error is coming from the $newPaymentTotal that I want use to update the price that was in there before. That column is set up as a decimal as well. Answer Your line $request->session()-&g…

how to do not update value on update function?

i want this code should not be run if user call upate route code i am using a same fucntion to update or store order but on update i donot want to run above code i know it is very simple but i am a student and learning help me here it is controller function first user create order the

Access data from a json array

I have this type of json object coming from a curl endpoint response: i want to access full_name from that response and display it on my index.blade.php view page as a list of name like this: Please assist me to access the value from that array above. Answer You can do like this : Above code tested here