Skip to content
Advertisement

Tag: relation

Laravel Relationship with integer[] type of postgresql column

I have categories table and products table. in products table have category_id column type of integer[]. ex: {1,2,3} . And I need products list with category relation which categories.id exist products.category_id I tried in model Product: no get category is null. Answer I can’t relation but with attribute i can get categories firstly cast category_id to array and and it

Image Preview from DB

I’m Trying to Preview images from database as im saving album in table albums and album images in table images and connecting with relation but i can’t preview the images from table image so i’m adding relations between the 2 tables and trying to preview the images but its not working with me something went wrong but i cannot figure

Eloquent – Update eloquent relations with foreach loop

I have a controller function to send multiple devices for repair (essentially an update request against multiple existing devices_repairs records). When I try to retrieve the devices from the devices table alongside the repair details (Devices table, devices_repairs table), the records are retrieved but when I try to update the values the update request doesn’t save the new data. This

Advertisement