-
app/Services/SmartPlaylistService.php
Open in GitHubuse Illuminate\Database\Eloquent\Builder; class SmartPlaylistService { // public function buildQueryFromRules(array $rules): Builder { $query = Song::query(); collect($rules)->each(static function (array $ruleGroup) use ($query): void { $query->orWhere(static function (Builder $subQuery) use ($ruleGroup): void { foreach ($ruleGroup['rules'] as $config) { Rule::create($config)->build($subQuery); } }); }); return $query; } // }