I'm making website for advertisements and people can publish things they are selling. So I have tables: cars
, technology
, real_estate
, pets
etc. All these tables have different columns except "created_at" column which is common for all tables.
Example:
CARS: [Model, Type, fuel type..., created_at]
PETS: [Name, Description..., created_at]
So if cars
has 5 rows and pets
has 7 and real_estate
has 3 I need in return 15 rows sorted by created_at
. I need to merge all 5 (or more) tables and sort them by created_at (without losing any of rows).
Do you have some tips or idea how to do that in laravel (Eloquent)?