cra*_*bly 12
它们不必是复数.为简化起见,默认情况下,Eloquent假设,如果您有模型User,那么您的数据库表将是users.但是,如果要为表创建另一个名称,可以通过定义table属性为模型指定自定义表.例如:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
protected $table = 'user';
...
}
Run Code Online (Sandbox Code Playgroud)
这将告诉Eloquent在使用user模型时使用数据库中的表User.
| 归档时间: |
|
| 查看次数: |
1962 次 |
| 最近记录: |