mirror of
https://github.com/michaelachrisco/ReadOnlyTraitLaravel.git
synced 2024-10-31 21:33:23 -07:00
Merge pull request #6 from michaelachrisco/readme-update
Readme Update with Laravel 5.3 methods
This commit is contained in:
commit
b886cc7600
1 changed files with 39 additions and 1 deletions
40
README.md
40
README.md
|
@ -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
|
||||||
|
|
||||||
|
###
|
||||||
|
|
Loading…
Reference in a new issue