scriptotek /
bibrex
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Rules; |
||
| 4 | |||
| 5 | use Illuminate\Contracts\Validation\Rule; |
||
| 6 | |||
| 7 | class NotGuestLtid implements Rule |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Create a new rule instance. |
||
| 11 | * |
||
| 12 | * @return void |
||
| 13 | */ |
||
| 14 | public function __construct() |
||
| 15 | { |
||
| 16 | $this->user = \Auth::user(); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Determine if the validation rule passes. |
||
| 21 | * |
||
| 22 | * @param string $attribute |
||
| 23 | * @param mixed $value |
||
| 24 | * @return bool |
||
| 25 | */ |
||
| 26 | public function passes($attribute, $value) |
||
| 27 | { |
||
| 28 | return $value != $this->user->guest_ltid; |
||
|
0 ignored issues
–
show
|
|||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Get the validation error message. |
||
| 33 | * |
||
| 34 | * @return string |
||
| 35 | */ |
||
| 36 | public function message() |
||
| 37 | { |
||
| 38 | return 'The validation error message.'; |
||
| 39 | } |
||
| 40 | } |
||
| 41 |