Skip to content

Commit 218aac0

Browse files
putchimichaelachrisco
authored andcommitted
Update ReadOnlyTrait.php (#26)
Declaration of class functions (e.g: firstOrCreate, firstOrNew, updateOrCreate) should be compatible with Illuminate\Database\Eloquent\Model
1 parent eb09087 commit 218aac0

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/ReadOnlyTrait.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,33 @@ public function update(array $attributes = [], array $options = [])
4949

5050
/**
5151
* Throws ReadOnlyException on firstOrCreate
52-
* @param array $arr
52+
* @param array $attributes
53+
* @param array $values
5354
* @throws ReadOnlyException
5455
*/
55-
public static function firstOrCreate(array $arr)
56+
public static function firstOrCreate(array $attributes, array $values = [])
5657
{
5758
throw new ReadOnlyException(__FUNCTION__, get_called_class());
5859
}
5960

6061
/**
6162
* Throws ReadOnlyException on firstOrNew
62-
* @param array $arr
63+
* @param array $attributes
64+
* @param array $values
6365
* @throws ReadOnlyException
6466
*/
65-
public static function firstOrNew(array $arr)
67+
public static function firstOrNew(array $attributes, array $values = [])
68+
{
69+
throw new ReadOnlyException(__FUNCTION__, get_called_class());
70+
}
71+
72+
/**
73+
* Throws ReadOnlyException on updateOrCreate
74+
* @param array $attributes
75+
* @param array $values
76+
* @throws ReadOnlyException
77+
*/
78+
public static function updateOrCreate(array $attributes, array $values = [])
6679
{
6780
throw new ReadOnlyException(__FUNCTION__, get_called_class());
6881
}
@@ -169,4 +182,4 @@ public function truncate()
169182
{
170183
throw new ReadOnlyException(__FUNCTION__, get_called_class());
171184
}
172-
}
185+
}

0 commit comments

Comments
 (0)