From 78530ae123aea4ad923eaecb4ede9a9b7a620e02 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 9 Jul 2018 21:57:45 -0700 Subject: [PATCH] Fix tests --- app/Http/Traits/UniqueSerialTrait.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Http/Traits/UniqueSerialTrait.php b/app/Http/Traits/UniqueSerialTrait.php index fc2291c7a3..be9a885c08 100644 --- a/app/Http/Traits/UniqueSerialTrait.php +++ b/app/Http/Traits/UniqueSerialTrait.php @@ -13,11 +13,10 @@ trait UniqueSerialTrait */ protected function prepareUniqueSerialRule($parameters, $field) { - $settings = \App\Models\Setting::first(); - - if ($settings->unique_serial=='1') { - return 'unique_undeleted:'.$this->table.','. $this->getKey(); + if ($settings = \App\Models\Setting::first()) { + if ($settings->unique_serial=='1') { + return 'unique_undeleted:'.$this->table.','. $this->getKey(); + } } - } }