jeudi 2 mars 2017

Laravel naming convention with similar Model names

This is a very basic question but trying to wrap my head around the preferred naming conventions for models/tables with similar names.

A model 'Task' can have many 'Comments' so the tables would be - tasks - comments (with a foreign key for task_id)

However, I have another model 'Post' which will also need a 'Comments' which is of course separate from the Comments for Tasks

In this scenario, does one generally go with - Task & TaskComment (model) / tasks & task_comments (database table) - Post & PostComment (model) / posts & post_comments (database table)

or some other convention?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire