php - How are the model I created using artisan and the migrate data table bound together in Laravel?
怪我咯
怪我咯 2017-05-16 13:00:45
0
2
401

Suppose I first create a table of questions using migrate;

Then I used artisan to create a model of Question;

There is no statement in the model that binds the data table. Why does the framework automatically search for my questions table when I write a method, and make corresponding additions, deletions, and modifications? Don’t you need to bind the table first?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
淡淡烟草味

Code location: IlluminateDatabaseEloquentModel.php

如果没有显式地定义protected $table='xxxx';The class name of the current Model will be used as the table name. This is not only laravel, many other PHP frameworks do this

伊谢尔伦

Correct answer upstairs...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template