From 218aac087f78e52944a487c4e7eb16c40ad2a46f Mon Sep 17 00:00:00 2001 From: Alex Rabinovich <4alexr@gmail.com> Date: Tue, 23 Oct 2018 00:00:30 +0300 Subject: [PATCH] Update ReadOnlyTrait.php (#26) Declaration of class functions (e.g: firstOrCreate, firstOrNew, updateOrCreate) should be compatible with Illuminate\Database\Eloquent\Model --- src/ReadOnlyTrait.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/ReadOnlyTrait.php b/src/ReadOnlyTrait.php index cdcd8fc..f88fb63 100644 --- a/src/ReadOnlyTrait.php +++ b/src/ReadOnlyTrait.php @@ -49,20 +49,33 @@ trait ReadOnlyTrait /** * Throws ReadOnlyException on firstOrCreate - * @param array $arr + * @param array $attributes + * @param array $values * @throws ReadOnlyException */ - public static function firstOrCreate(array $arr) + public static function firstOrCreate(array $attributes, array $values = []) { throw new ReadOnlyException(__FUNCTION__, get_called_class()); } /** * Throws ReadOnlyException on firstOrNew - * @param array $arr + * @param array $attributes + * @param array $values * @throws ReadOnlyException */ - public static function firstOrNew(array $arr) + public static function firstOrNew(array $attributes, array $values = []) + { + throw new ReadOnlyException(__FUNCTION__, get_called_class()); + } + + /** + * Throws ReadOnlyException on updateOrCreate + * @param array $attributes + * @param array $values + * @throws ReadOnlyException + */ + public static function updateOrCreate(array $attributes, array $values = []) { throw new ReadOnlyException(__FUNCTION__, get_called_class()); } @@ -169,4 +182,4 @@ trait ReadOnlyTrait { throw new ReadOnlyException(__FUNCTION__, get_called_class()); } -} \ No newline at end of file +}