I was using the "tinker" artisan's command to try out if I understood models local scopes correcty, by running this command:
$ art tinker
Psy Shell v0.12.3 (PHP 8.3.7 — cli) by Justin Hileman
> Company::master()->get();
[!] Aliasing 'Company' to 'App\Models\Company' for this Tinker session.
Segmentation fault
Here is how I defined my Company model:
class Company extends Model {
use HasFactory, HasUuids, SoftDeletes;
protected $fillable = [
'name',
];
public function users(): HasMany {
return $this->hasMany(User::class);
}
public function quotes(): HasManyThrough {
return $this->hasManyThrough(Quote::class, User::class);
}
public function scopeMaster(Builder $query) {
$query->where('is_master', 1);
}
}
I thought the problem was in the scope method I created, but it segfaults even if I do not use it:
$ art tinker
Psy Shell v0.12.3 (PHP 8.3.7 — cli) by Justin Hileman
> Company::all()->get();
[!] Aliasing 'Company' to 'App\Models\Company' for this Tinker session.
Segmentation fault