mirror of
https://github.com/michaelachrisco/ReadOnlyTraitLaravel.git
synced 2024-12-28 00:27:20 -08:00
5627a5523c
* Refactor for PSR-2 Formatting standard and PHP DockBlock standard. * Setting real php requirement (full param casting is available since php7) * php 7 for travis
172 lines
No EOL
4.1 KiB
PHP
172 lines
No EOL
4.1 KiB
PHP
<?php
|
|
namespace MichaelAChrisco\ReadOnly;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use MichaelAChrisco\ReadOnly\ReadOnlyException;
|
|
|
|
trait ReadOnlyTrait
|
|
{
|
|
/**
|
|
* Throws ReadOnlyException on create
|
|
* @param array $attributes
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public static function create(array $attributes = [])
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on forceCreate
|
|
* @param array $attributes
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public static function forceCreate(array $attributes)
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on save
|
|
* @param array $options
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public function save(array $options = [])
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on update
|
|
* @param array $attributes
|
|
* @param array $options
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public function update(array $attributes = [], array $options = [])
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on firstOrCreate
|
|
* @param array $arr
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public static function firstOrCreate(array $arr)
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on firstOrNew
|
|
* @param array $arr
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public static function firstOrNew(array $arr)
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on delete
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public function delete()
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on destroy
|
|
* @param mixed $ids
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public static function destroy($ids)
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on restore
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public function restore()
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on forceDelete
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public function forceDelete()
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on performDeleteOnModel
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public function performDeleteOnModel()
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on push
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public function push()
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on finishSave
|
|
* @param array $options
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public function finishSave(array $options)
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on performUpdate
|
|
* @param Builder $query
|
|
* @param array $options
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public function performUpdate(Builder $query, array $options = [])
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on touch
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public function touch()
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on insert
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public function insert()
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
|
|
/**
|
|
* Throws ReadOnlyException on truncate
|
|
* @throws ReadOnlyException
|
|
*/
|
|
public function truncate()
|
|
{
|
|
throw new ReadOnlyException(__FUNCTION__, get_called_class());
|
|
}
|
|
} |