我在我的应用程序上有一个名为Shift的模型,我在它上面定义了我的关系和作用域,如下所示: 关系: public function status() return $this->belongsTo(ShiftStatus::class);{
$query->with('status');} 现在,当我检索移位并尝试调用这些作用域<
'event_type']) ->get(); 因为我的模型中的许多地方都需要它们,所以我尝试使用回调来执行代码重构** This is not working, obviously but you guys can get the idea of what I'm trying to do */ 所以问题是,我想使用链接来提高可读性,我在想,如果我可以使用Macro