psycho_cfh
psycho_cfh
FFilament
Created by psycho_cfh on 12/14/2023 in #❓┊help
morphedByMany in RelationManager error without allowDuplicates
can someone help me please
4 replies
FFilament
Created by psycho_cfh on 12/14/2023 in #❓┊help
morphedByMany in RelationManager error without allowDuplicates
i found this problem, when i use the AttachAction on Relation Manager if i don't use allowDuplicates() give me an query error. SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order_items.product_id' in 'where clause'
select distinct `products`.* from `products` left join `order_items` on `products`.`id` = `order_items`.`order_item_id` where (`products`.`name` like %f%) and not exists (select * from `orders` inner join `order_items` on `orders`.`id` = `order_items`.`order_item_id` where `products`.`id` = `order_items`.`product_id` and `order_items`.`order_item_type` = App\Models\Order and `orders`.`id` = 3) order by `products`.`name` asc limit 50
select distinct `products`.* from `products` left join `order_items` on `products`.`id` = `order_items`.`order_item_id` where (`products`.`name` like %f%) and not exists (select * from `orders` inner join `order_items` on `orders`.`id` = `order_items`.`order_item_id` where `products`.`id` = `order_items`.`product_id` and `order_items`.`order_item_type` = App\Models\Order and `orders`.`id` = 3) order by `products`.`name` asc limit 50
the correct query shoul be
select distinct `products`.* from `products` left join `order_items` on `products`.`id` = `order_items`.`order_item_id` where (`products`.`name` like %f%) and not exists (select * from `orders` inner join `order_items` on `orders`.`id` = `order_items`.`order_item_id` where `products`.`id` = `order_items`.`order_item_id` and `order_items`.`order_item_type` = App\Models\Product and `orders`.`id` = 3) order by `products`.`name` asc limit 50
select distinct `products`.* from `products` left join `order_items` on `products`.`id` = `order_items`.`order_item_id` where (`products`.`name` like %f%) and not exists (select * from `orders` inner join `order_items` on `orders`.`id` = `order_items`.`order_item_id` where `products`.`id` = `order_items`.`order_item_id` and `order_items`.`order_item_type` = App\Models\Product and `orders`.`id` = 3) order by `products`.`name` asc limit 50
4 replies
FFilament
Created by psycho_cfh on 12/11/2023 in #❓┊help
morphToMany issue with RelationManager
the problem i think is order by products.order_id asc limit 50
3 replies
FFilament
Created by psycho_cfh on 12/11/2023 in #❓┊help
morphToMany issue with RelationManager
This is the query with error
select `products`.`order_id`, `products`.`id` from `products` inner join `order_items` on `products`.`id` = `order_items`.`order_item_id` where (`products`.`order_id` like %f%) and not exists (select * from `orders` inner join `order_items` on `orders`.`id` = `order_items`.`order_id` where `products`.`id` = `order_items`.`order_item_id` and `order_items`.`order_item_type` = App\Models\Product and `orders`.`id` = 2) order by `products`.`order_id` asc limit 50
select `products`.`order_id`, `products`.`id` from `products` inner join `order_items` on `products`.`id` = `order_items`.`order_item_id` where (`products`.`order_id` like %f%) and not exists (select * from `orders` inner join `order_items` on `orders`.`id` = `order_items`.`order_id` where `products`.`id` = `order_items`.`order_item_id` and `order_items`.`order_item_type` = App\Models\Product and `orders`.`id` = 2) order by `products`.`order_id` asc limit 50
3 replies