Skip to content
Advertisement

Data output from the database

I have a select and I want to output data from the DB In CreateController I wrote this I have a UserGuild database And I have such a mistake I need to output to select what is in the User Guide database, but at the same time where {{$guild->name}}and value were were values from the Guild database I also tried

Apache not return Laravel json validation errors on Test but works on Dev

I’ve been working on a Laravel API with validation. I’m sending this request to the server: On my development system, running windows/Apache/PHP 8.1, the POST requests return a JSON object containing validation errors. But my test system, running Linux/Apache/PHP 8.1, does not return a JSON response: Here is my code: api.php StoreClientRequest.php ClientAPIController.php Since it’s working on my localhost I

Get data from a form using post

I have three dropdowns and I can’t get data from two of them using POST, here is my code: I can get the categoryID but not from the supplier or order status Answer All three select has same name attribute please change the values name=”category_id”

php extended class in namespace refactor

I have made a class inside a namespace which is working perfectly fine but I think the code can be better. Right now I have to use a ‘/’ for every object inside the class which is not the best thing to do I assume. } Is it possible to do something like this? So I dont have to use

Laravel : Combine two tables using Model relations

i have two tables :: shops and attachments . Shops has all the details for shop and attachments with all the pictures for shop with ref_id as FK . now for mobile app i have to list shops with Shop title and one image. I can achieve it using leftjoin as below. This returns just shop name and pictures ,

query inside with eloquent

image address has location and total number of users. this query will return all the users and on relation whose query did not match will be null .I want to pull only those users which do not null value on relation and order By accordingly. Answer You can use whereHas condition

How to implicitly binding multiple Eloquent models in a single route definition?

Laravel9 document says: When implicitly binding multiple Eloquent models in a single route definition, you may wish to scope the second Eloquent model such that it must be a child of the previous Eloquent model. For example, consider this route definition that retrieves a blog post by slug for a specific user: When using a custom keyed implicit binding as

Laravel API controller return object along with other arguments

In API controller index function $response holds id’s of media items from db table And if $is_published_pack == ‘false’ I’m successfully returning How to append $response inside when $is_published_pack true condition is met? $response value is I’ve tried for example doing this but it throws error Complete API controller index function: Answer you may try this: hope this solves your

Advertisement