diff --git a/app/Rules/CategoryRule.php b/app/Rules/CategoryRule.php index acc10a28..1a29397a 100644 --- a/app/Rules/CategoryRule.php +++ b/app/Rules/CategoryRule.php @@ -17,8 +17,8 @@ class CategoryRule implements InvokableRule */ public function __invoke($attribute, $value, $fail) { - $category = Category::find($value); - if($category){ + $category = Category::find((int)$value); + if(!$category){ $fail('There is no :attribute with value: ' . $value); } } diff --git a/app/Rules/TicketRule.php b/app/Rules/TicketRule.php index 3aef5ac6..236d4ce4 100644 --- a/app/Rules/TicketRule.php +++ b/app/Rules/TicketRule.php @@ -17,8 +17,8 @@ class TicketRule implements InvokableRule */ public function __invoke($attribute, $value, $fail) { - $ticket = Ticket::find($value); - if($ticket){ + $ticket = Ticket::find((int)$value); + if(!$ticket){ $fail('There is no :attribute with value: ' . $value); } }