mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-27 23:46:34 +01:00
Added settings section and custom cron scheduling
This commit is contained in:
41
app/Rules/Cron.php
Normal file
41
app/Rules/Cron.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use Cron\CronExpression;
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class Cron implements Rule
|
||||
{
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
return CronExpression::isValidExpression($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return 'The :attribute field must be a valid cron expression.';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user