File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 1- # Read Only Laravel 5 Models
2- The Read only trait Monkey Patches Laravel models to not save, delete or modify models.
3- Ideally, this would be used in addition to DB permissions to ensure Users and Developers cannot write to a Legacy system of some kind.
1+ # Laravel 5+ Read Only Models
2+ The read only trait removes the ability to save, delete or modify Laravel models.
3+ Ideally, this would be used in addition to DB permissions to ensure users and developers cannot write to a Legacy system.
4+
5+ ## Install
6+
7+ ```
8+ composer require michaelachrisco/readonly
9+ ```
410
5- This is only a simple demonstration of the model.
611## To use:
712
13+
14+
815``` php
916<?php
10- require_once('src/ReadOnlyTrait.php'); //Or register under your config/App.php
11- // use MichaelAChrisco\ReadOnlyTrait; //optional
1217use Illuminate\Database\Eloquent\Model;
1318class User extends Model {
14- use MichaelAChrisco\ReadOnly\ReadOnlyTrait;
19+ use \ MichaelAChrisco\ReadOnly\ReadOnlyTrait;
1520}
1621
1722$legacyUser = new User;
You can’t perform that action at this time.
0 commit comments