Skip to content
Advertisement

Tag: laravel

Insert price to the pivot table

I am trying to insert data to a pivot table order_serrvice using arrays I follow this code: https://blog.quickadminpanel.com/master-detail-form-in-laravel-jquery-create-order-with-products/ the column qty and service was inserted properly but the price does not, I dont know why? order_service table: OrderController: with dd($request): dd($price[$service]) Data base outbut Can any one help? Answer In your controller, you are misusing the attach() method: The attach()

Convert SQL to Laravel ORM RELATONS

It is working but I should do with Relaion Like this… But it is not working because whereHas returns a collection, What I can do ??? Please give advice. Answer This is working thank you !!!

Display all data which are between these dates

So currently, I am trying to display a list of items which are not between date X and date Y. Let us assume that book_date_start = 2021-06-15, and bookdate_end = 2021-06-20 This is my current query: So based on this So basically as I was writing the above out, I realized that my query is WRONG, and since 2021-06-13 is

Delete unused groups in Laravel 8

I have a group model and I want to delete groups that don’t have any member. How can I get empty groups with eloquent or SQL query ? And this is the User model code: Answer I think whereDoesntHave work in you situation.

Advertisement