承接 michaelachrisco/readonly 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

michaelachrisco/readonly

最新稳定版本:v1.1.0

Composer 安装命令:

composer require michaelachrisco/readonly

包简介

Readonly Models for Laravel 5+

README 文档

README

Total Downloads build workflow Latest Version on Packagist

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

To use:

<?php
use Illuminate\Database\Eloquent\Model;
use MichaelAChrisco\ReadOnly\ReadOnlyTrait;
class User extends Model {
  use ReadOnlyTrait;
}

$legacyUser = new User;
$legacyUser->set_user_name('bob');

$result = $legacyUser->save();
//User is not saved. 
//ReadOnlyException is thrown.
 ?>

Methods that will throw ReadOnlyExceptions:

  • create
  • forceCreate
  • save
  • update
  • firstOrCreate
  • firstOrNew
  • delete
  • destroy
  • restore
  • forceDelete
  • performDeleteOnModel
  • push
  • finishSave
  • performUpdate
  • touch
  • insert
  • truncate
  • Add in a PR for any other methods you can find!

统计信息

  • 总下载量: 1.95M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 159
  • 点击次数: 1
  • 依赖项目数: 5
  • 推荐数: 0

GitHub 信息

  • Stars: 159
  • Watchers: 3
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-28