laravel eloquent實(shí)作原理
如:
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);這個(gè)是這樣實(shí)現(xiàn)表的綁定的
我來(lái)試著回答下。不熟悉,剛接觸,希望沒(méi)誤導(dǎo)。
你可以看到BusinessWork繼承了Eloquent,同時(shí)有自己的表格、可操作欄位屬性等。
BusinessWork::find(1),是繼承自Eloquent中的,同時(shí)還有取出所有記錄:BusinessWork::all()等一些常用操作,也可以在BusinessWork中重寫這些。
你可以抽空出門左拐百度或右轉(zhuǎn)Google下Laravel的Eloquent ORM文件。
希望能幫到你。