mirror of
https://github.com/michaelachrisco/ReadOnlyTraitLaravel.git
synced 2024-10-31 21:33:23 -07:00
Update ReadOnlyTrait.php (#26)
Declaration of class functions (e.g: firstOrCreate, firstOrNew, updateOrCreate) should be compatible with Illuminate\Database\Eloquent\Model
This commit is contained in:
parent
eb090875d5
commit
218aac087f
1 changed files with 18 additions and 5 deletions
|
@ -49,20 +49,33 @@ trait ReadOnlyTrait
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throws ReadOnlyException on firstOrCreate
|
* Throws ReadOnlyException on firstOrCreate
|
||||||
* @param array $arr
|
* @param array $attributes
|
||||||
|
* @param array $values
|
||||||
* @throws ReadOnlyException
|
* @throws ReadOnlyException
|
||||||
*/
|
*/
|
||||||
public static function firstOrCreate(array $arr)
|
public static function firstOrCreate(array $attributes, array $values = [])
|
||||||
{
|
{
|
||||||
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throws ReadOnlyException on firstOrNew
|
* Throws ReadOnlyException on firstOrNew
|
||||||
* @param array $arr
|
* @param array $attributes
|
||||||
|
* @param array $values
|
||||||
* @throws ReadOnlyException
|
* @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());
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue