mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-08-05 15:42:14 +00:00
fix(recurring-invoices): scale scheduled generation
This commit is contained in:
23
app/Rules/ValidCronExpression.php
Normal file
23
app/Rules/ValidCronExpression.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use Closure;
|
||||
use Cron\CronExpression;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Translation\PotentiallyTranslatedString;
|
||||
|
||||
class ValidCronExpression implements ValidationRule
|
||||
{
|
||||
/**
|
||||
* Run the validation rule.
|
||||
*
|
||||
* @param Closure(string, ?string=): PotentiallyTranslatedString $fail
|
||||
*/
|
||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||
{
|
||||
if (! is_string($value) || ! CronExpression::isValidExpression($value)) {
|
||||
$fail('The frequency must be a valid cron expression.');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user