By default, Laravel is assuming that the database table is the plural form of the model name. But what if my table name is \"news\" and i still want to use this feature? sho
If you have a model ending with the letter 's', it will keep the table name the same. In your case, your model will name your table news
by default.
If you want to use another name though, you can use:
protected $table = 'tablename';
inside of your model.
EDIT: I tested this in my application. I made a model named News
. Then I made a new instance of News
and retrieved the table name:
$news = new News();
dd($news->getTable());
It returns: news