| Total Complexity | 3 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class ValidIdRule implements Rule |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * The fully qualified classname of the model to check. |
||
| 12 | * |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | protected $className; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Create a rule that tests that a value is a valid id for the specified eloquent model. |
||
| 19 | * |
||
| 20 | * @param string $className |
||
|
1 ignored issue
–
show
|
|||
| 21 | */ |
||
| 22 | 5 | public function __construct(string $className) |
|
| 23 | { |
||
| 24 | 5 | $this->className = $className; |
|
| 25 | 5 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Determine if the validation rule passes. |
||
| 29 | * |
||
| 30 | * @param string $attribute |
||
|
2 ignored issues
–
show
|
|||
| 31 | * @param mixed $value |
||
|
1 ignored issue
–
show
|
|||
| 32 | * @return bool |
||
|
1 ignored issue
–
show
|
|||
| 33 | */ |
||
| 34 | 5 | public function passes($attribute, $value) |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Get the validation error message. |
||
| 42 | * |
||
| 43 | * @return string |
||
| 44 | */ |
||
| 45 | 1 | public function message() |
|
| 48 | } |
||
| 49 | } |
||
| 50 |