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:
Alex Rabinovich 2018-10-23 00:00:30 +03:00 committed by Michael Chrisco
parent eb090875d5
commit 218aac087f

View file

@ -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());
} }
@ -169,4 +182,4 @@ trait ReadOnlyTrait
{ {
throw new ReadOnlyException(__FUNCTION__, get_called_class()); throw new ReadOnlyException(__FUNCTION__, get_called_class());
} }
} }