mirror of
https://github.com/koel/koel
synced 2024-11-14 00:17:13 +00:00
20 lines
476 B
PHP
20 lines
476 B
PHP
<?php
|
|
|
|
namespace App\Rules;
|
|
|
|
use App\Values\SmartPlaylistRuleGroupCollection;
|
|
use Illuminate\Contracts\Validation\Rule;
|
|
use Illuminate\Support\Arr;
|
|
|
|
class ValidSmartPlaylistRulePayload implements Rule
|
|
{
|
|
public function passes($attribute, $value): bool
|
|
{
|
|
return (bool) attempt(static fn () => SmartPlaylistRuleGroupCollection::create(Arr::wrap($value)));
|
|
}
|
|
|
|
public function message(): string
|
|
{
|
|
return 'Invalid smart playlist rules';
|
|
}
|
|
}
|