-
app/Scopes/OrderNameScope.php
Open in GitHubuse Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; class OrderNameScope implements Scope { public function apply(Builder $builder, Model $model): void { $builder->orderBy('name', 'ASC'); } }
-
app/Models/LinkList.php
Open in GitHubuse App\Scopes\OrderNameScope; class LinkList extends Model { protected static function boot(): void { parent::boot(); static::addGlobalScope(new OrderNameScope()); } }