v
Событие created и вешаем через plugin -> boot на нужную модель.
Size: a a a
v
SR
SR
A
SR
A
v
$this[ 'list' ] = $spec->where( 'slug', $slug )->with([Где, specs это связь $belongsToMany. Внутри specs - obects ($belongsToMany).
'specs' =>function($p){
$p->isPublished()->orderBy('id', 'DESC');
},
'specs.obects' =>function($p){
$p->isPublished()->orderBy('name', 'ASC')->distinct()->groupBy('id');
}
])
->first();
AM
v
$this[ 'list' ] = $spec->where( 'slug', $slug )->with([
'specs' =>function($p){
$p->with(['obects' => function($p) {
$p->isPublished()->orderBy('name', 'ASC');
}])->isPublished()->orderBy('id', 'DESC');
},
])
->first();
AM
$this[ 'list' ] = $spec->where( 'slug', $slug )->with([
'specs' =>function($p){
$p->with(['obects' => function($p) {
$p->isPublished()->orderBy('name', 'ASC');
}])->isPublished()->orderBy('id', 'DESC');
},
])
->first();
AM
AM
AM
SR
Э
IS
IS
IS
A
I