From d48a02dd321918687dce0b2ed42af8abe34091df Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Tue, 31 Oct 2017 21:29:40 -0400 Subject: [PATCH] add back findWithoutFail --- .idea/php.xml | 7 ++++++- app/Repositories/BaseRepository.php | 12 +++++++++++- phpvms.iml | 19 +++++++++++++++++-- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.idea/php.xml b/.idea/php.xml index 9d42ae43..f79a398f 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -115,6 +115,11 @@ + + + + + @@ -130,7 +135,7 @@ - + \ No newline at end of file diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php index c15d20b3..9af49388 100644 --- a/app/Repositories/BaseRepository.php +++ b/app/Repositories/BaseRepository.php @@ -7,7 +7,17 @@ use Illuminate\Validation\Validator; abstract class BaseRepository extends \Prettus\Repository\Eloquent\BaseRepository { - public function validate($values) { + public function findWithoutFail($id, $columns = ['*']) + { + try { + return $this->find($id, $columns); + } catch (Exception $e) { + return; + } + } + + public function validate($values) + { $validator = Validator::make( $values, $this->model()->rules diff --git a/phpvms.iml b/phpvms.iml index da1b1d27..6681fefd 100644 --- a/phpvms.iml +++ b/phpvms.iml @@ -12,6 +12,7 @@ + @@ -21,7 +22,11 @@ + + + + @@ -42,6 +47,7 @@ + @@ -51,7 +57,11 @@ + + + + @@ -70,6 +80,7 @@ + @@ -79,7 +90,11 @@ + + + + @@ -93,11 +108,11 @@ - + - +