From 0a49726dbd2afb7384d7aca6809749c452d9377a Mon Sep 17 00:00:00 2001 From: ilmedova Date: Fri, 12 Aug 2022 13:53:03 +0500 Subject: [PATCH] rules fixed logic --- app/Rules/CategoryRule.php | 4 ++-- app/Rules/TicketRule.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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); } }