Last active
May 31, 2021 09:56
-
-
Save alixcan/59b151f642cefc5f5cb337a7fdf6ac6d to your computer and use it in GitHub Desktop.
Disable eloquent Creating, Updating, Saving, Deleting actions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Traits; | |
| use Illuminate\Http\Request; | |
| trait DisableDBEntries | |
| { | |
| /** | |
| * The "booted" method of the model. | |
| * | |
| * @return void | |
| */ | |
| protected static function booted() | |
| { | |
| static::creating(function ($user) { | |
| return false; | |
| }); | |
| static::updating(function ($user) { | |
| return false; | |
| }); | |
| static::saving(function ($user) { | |
| return false; | |
| }); | |
| static::deleting(function ($user) { | |
| return false; | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment