mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-11-13 09:38:48 +01:00
26 lines
620 B
PHP
26 lines
620 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Scopes;
|
|
|
|
use App\Models\Wiki\SongStaff;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Scope;
|
|
|
|
class PerformanceScope implements Scope
|
|
{
|
|
/**
|
|
* Apply the scope to a given Eloquent query builder.
|
|
*/
|
|
public function apply(Builder $builder, Model $model): void
|
|
{
|
|
$builder->where(function (Builder $query) {
|
|
$query
|
|
->where(SongStaff::ATTRIBUTE_ROLE, 'Performance')
|
|
->orWhereLike(SongStaff::ATTRIBUTE_ROLE, 'feat%');
|
|
});
|
|
}
|
|
}
|