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…
Tag: laravel
How to generate a GET request Swagger API Doc in Laravel 5.8 API?
I’m using L5-Swagger framework to generate an API Doc for my Laravel 5.8 project. Here is the code I have created so far: This is an endpoint with limit and offset. I added limit as a parameter here just to check. But it is not generating. Only the endpoint with path is available in the Swagger UI. Plea…
Getting error of no such file or directory while doing command php artisan migrate on laravel on Ubuntu linux OS
I m in ubuntu 20.04.I installed fresh laravel and when i set all .env configuration, also database but getting error as below: SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = laravel1 and table_name = migrations and table_type = ‘BASE T…
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
Form data isn’t submitting to database in Laravel controller
In my home page in my Laravel project I have a modal which contains a form. <div class=&…
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…
Laravel Sanctum returns 500 when trying to access sanctum protected API
I am using Laravel 8.12 with PostgreSQL. I am trying to use Laravel Sanctum as authentication for my API. This is the schema for sanctum: And this is my user table: Now, when I try to send the token in headers, I get this error: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for t…