Laravel -T

SQL语句调试

DB::enableQueryLog();
SQL语句
dd(DB::getQueryLog());

 

with语句拼接

$this->with(['cureMedicines' => function ($query) use ($id) {
$query->select('patient_id', 'item_id', 'name')->with(['item' => function ($query) use ($id) {
$query->where('id', $id)->select();
}]);
}]);

 

添加公共模型

static::addGlobalScope(new Auth(0));

 

移除公共模型

static::withoutGlobalScopes([Auth::class])->select();

 

 

资源路由

 

posted @ 2022-02-24 23:45  悬剑丶  阅读(43)  评论(0编辑  收藏  举报