This forum has moved to a new location and is in read-only mode. Please visit to access the new location.


I'm building a classified ads system and what I need is to specify different attributes for some of the categories. Lets say, cars, real estates etc. Every ad will have

  • id
  • name
  • desc ...

and I was thing should I make another table for lets say car category

  • ad_id
  • body
  • paint
  • registration etc.

Whats the best solutions and how to build it ?


That makes sense, putting the common attributes on one table and then the specific attributes on another table.

So the Ad table has a type and then you can use a morphed relationship to the specific table.

class Ad extends Model
    public $morphTo = [
        'detailable' => []

Read more about polymorphic relationships in the docs:

1-2 of 2

You cannot edit posts or make replies: the forum has moved to