Merge pull request #6 from michaelachrisco/readme-update

Readme Update with Laravel 5.3 methods
This commit is contained in:
michaelachrisco 2016-12-06 11:22:09 -08:00 committed by GitHub
commit b886cc7600

View file

@ -10,13 +10,51 @@ This is only a simple demonstration of the model.
require_once('src/ReadOnlyTrait.php'); //Or register under your config/App.php require_once('src/ReadOnlyTrait.php'); //Or register under your config/App.php
// use MichaelAChrisco\ReadOnlyTrait; //optional // use MichaelAChrisco\ReadOnlyTrait; //optional
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class User extends Illuminate\Database\Eloquent\Model { class User extends Model {
use MichaelAChrisco\ReadOnly\ReadOnlyTrait; use MichaelAChrisco\ReadOnly\ReadOnlyTrait;
} }
$legacyUser = new User; $legacyUser = new User;
$legacyUser->set_user_name('bob'); $legacyUser->set_user_name('bob');
$result = $legacyUser->save(); $result = $legacyUser->save();
//User is not saved and $result is false. //User is not saved and $result is false.
?> ?>
``` ```
## Methods that will return false:
* create
* forceCreate
* save
* update
* firstOrCreate
* firstOrNew
* delete
* destroy
* restore
* forceDelete
## TODO:
* performDeleteOnModel
* push
* saveOrFail
* finishSave
* performUpdate
* performInsert(??)
* insertAndSetId(??)
* touch
* Add in a PR for any other methods you can find!
### registerModelEvents( look into best way to implement)
* saving
* saved
* updating
* updated
* creating
* created
* deleting
* deleted
###