Committed to the LaraBrain by:
at January 26, 2016 4:58 pm
Somtimes you need to override Laravel's default table naming convention. This short post shows you how.
Like most web frameworks, Laravel will presume a model's underlying table name is the lowercase plural version of the model name. For example given a model named
Tip, the underlying table name is presumed to be
tips. You can however easily change this to suit for instance the requirements of a legacy database. Just open the model (for instance
app/Tip.php) and add the following property:
protected $table = "larabrain_tips";