laravel eloquent實現(xiàn)原理
如:
<?php
class BusinessWork extends Eloquent
{
/**
* The database table used by the model.
* @var string
*/
protected $table = 'businessWork';
protected $connection = 'mysql';
public $timestamps = 0;
protected $fillable = array(
'businessId',
'title',
'content',
'createAt',
);
}
BusinessWork::find(1);這個是這么實現(xiàn)表的綁定的
我來試著回答下。不熟悉,剛接觸,希望沒誤導(dǎo)。
你可以看到BusinessWork繼承了Eloquent,同時有自己的表、可操作字段屬性等。
BusinessWork::find(1),是繼承自Eloquent中的,同時還有取出所有記錄:BusinessWork::all()等一些常用操作,也可以在BusinessWork中重寫這些。
你可以抽空出門左拐百度或者右拐Google下Laravel的Eloquent ORM文檔。
希望能幫到你。