Skip to content

Tag: laravel

How to make sql nested/sub query in PHP

I’m struggling with implementing SQL query into my php code. The query: I was able to prepare only this part: And it works, but it is only responsible for the nested part, for the subquery if I can call it like this. Can someone share any thoughts? Answer DB::table() usually receive table name as a stri…

Laravel ajax passing data to php

I have a special problem. I am making an Ajax request to get data from the db without updating. The response I get should be outputted in a advanced way like this: Right now I get the correct response from the Ajax request. But how do I output it like that, with the include also and it should appear many

Catch HTTP client errors in Laravel 8

How do you catch errors thrown by the HTTP client (for example a time out) so that it doesn’t throw the curl error in the Laraval debugger (in debug mode) before you can do anything with the error to avoid stopping the execution? Instead, I’m always getting the Laravel’s Ignition error page …

Class ‘AppmodelProduct’ not found in category.blade.php

For my Laravel assignment I am working on a store, and using models to create the pages of shown products. However, the view pages gives me the error of class not found. I am a bit stumped on that to be honest. Here is the controller I use: Said Model: the Category model (just in case): and finally, the view

how to append `request()->input()` to GET form action

I have a filtration page to get the posts according to user choices, I want to give the user the ability to choose multiple ways to filter, such as the price, post date, category, …etc. therefore I should append the user’s previous choices. for example ex: example.com?category=1 and now the user w…

How to join relationships in Eloquent?

I’m stuck in a problem, I have these 3 models: Order, OrderItem and Product, each Order has many Order Items, and each Order Item has one Prduct but a Product can be ordered several times. Product has a supplier ID column (each supplier has many Products). So here are the relationships: Model: Order: Mo…