mirror of
https://github.com/michaelachrisco/ReadOnlyTraitLaravel.git
synced 2024-11-01 05:43:22 -07:00
Grammar and composer instructions (#11)
This commit is contained in:
parent
0c770109cb
commit
5664a0f191
1 changed files with 12 additions and 7 deletions
19
README.md
19
README.md
|
@ -1,17 +1,22 @@
|
||||||
# Read Only Laravel 5 Models
|
# Laravel 5+ Read Only Models
|
||||||
The Read only trait Monkey Patches Laravel models to not save, delete or modify models.
|
The read only trait removes the ability to save, delete or modify Laravel models.
|
||||||
Ideally, this would be used in addition to DB permissions to ensure Users and Developers cannot write to a Legacy system of some kind.
|
Ideally, this would be used in addition to DB permissions to ensure users and developers cannot write to a Legacy system.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
composer require michaelachrisco/readonly
|
||||||
|
```
|
||||||
|
|
||||||
This is only a simple demonstration of the model.
|
|
||||||
## To use:
|
## To use:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
require_once('src/ReadOnlyTrait.php'); //Or register under your config/App.php
|
|
||||||
// use MichaelAChrisco\ReadOnlyTrait; //optional
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
class User extends Model {
|
class User extends Model {
|
||||||
use MichaelAChrisco\ReadOnly\ReadOnlyTrait;
|
use \MichaelAChrisco\ReadOnly\ReadOnlyTrait;
|
||||||
}
|
}
|
||||||
|
|
||||||
$legacyUser = new User;
|
$legacyUser = new User;
|
||||||
|
|
Loading…
Reference in a new issue