mirror of
https://github.com/michaelachrisco/ReadOnlyTraitLaravel.git
synced 2024-12-26 07:37:20 -08: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
|
||||
The Read only trait Monkey Patches Laravel models to not save, delete or modify 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.
|
||||
# Laravel 5+ Read Only 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.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
composer require michaelachrisco/readonly
|
||||
```
|
||||
|
||||
This is only a simple demonstration of the model.
|
||||
## To use:
|
||||
|
||||
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once('src/ReadOnlyTrait.php'); //Or register under your config/App.php
|
||||
// use MichaelAChrisco\ReadOnlyTrait; //optional
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
class User extends Model {
|
||||
use MichaelAChrisco\ReadOnly\ReadOnlyTrait;
|
||||
use \MichaelAChrisco\ReadOnly\ReadOnlyTrait;
|
||||
}
|
||||
|
||||
$legacyUser = new User;
|
||||
|
|
Loading…
Reference in a new issue