Код: Выделить всё
class Cyclist extends User
{
protected $table = 'users';
protected static function boot()
{
parent::boot();
static::addGlobalScope('cyclist', function (Builder $builder) {
$builder->where('is_active', 'ok');
});
}
Код: Выделить всё
$l = Cyclist::query()
->join('cyclist_table','cyclist_table.user_id','=','users.id')
->first();
dd($l);
Подробнее здесь: https://stackoverflow.com/questions/790 ... sers-model