{"id":21391632,"url":"https://github.com/michaelachrisco/readonlytraitlaravel","last_synced_at":"2025-05-15T10:07:17.131Z","repository":{"id":6163726,"uuid":"54913038","full_name":"michaelachrisco/ReadOnlyTraitLaravel","owner":"michaelachrisco","description":"Laravel Read Only Model Traits","archived":false,"fork":false,"pushed_at":"2025-01-30T22:30:14.000Z","size":50,"stargazers_count":154,"open_issues_count":2,"forks_count":14,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-15T10:06:35.967Z","etag":null,"topics":["eloquent","eloquent-models","laravel","laravel-5-package","laravel-model","laravel-models","laravel-read","php","read-only-laravel"],"latest_commit_sha":null,"homepage":"https://github.com/michaelachrisco/ReadOnlyTraitLaravel","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelachrisco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-28T18:13:20.000Z","updated_at":"2025-05-03T14:21:50.000Z","dependencies_parsed_at":"2023-02-17T23:55:15.337Z","dependency_job_id":"699b1f55-6654-49dd-a615-bebb8b54e118","html_url":"https://github.com/michaelachrisco/ReadOnlyTraitLaravel","commit_stats":{"total_commits":43,"total_committers":10,"mean_commits":4.3,"dds":"0.34883720930232553","last_synced_commit":"e39f062e366b08e3446c2df2fbd95c76cd2ff95b"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelachrisco%2FReadOnlyTraitLaravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelachrisco%2FReadOnlyTraitLaravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelachrisco%2FReadOnlyTraitLaravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelachrisco%2FReadOnlyTraitLaravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelachrisco","download_url":"https://codeload.github.com/michaelachrisco/ReadOnlyTraitLaravel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319722,"owners_count":22051074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eloquent","eloquent-models","laravel","laravel-5-package","laravel-model","laravel-models","laravel-read","php","read-only-laravel"],"created_at":"2024-11-22T13:35:41.186Z","updated_at":"2025-05-15T10:07:12.114Z","avatar_url":"https://github.com/michaelachrisco.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Total Downloads](https://img.shields.io/packagist/dt/michaelachrisco/readonly.svg)](https://packagist.org/packages/michaelachrisco/readonly)\n![build workflow](https://github.com/michaelachrisco/ReadOnlyTraitLaravel/actions/workflows/build.yml/badge.svg)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/michaelachrisco/readonly.svg)](https://packagist.org/packages/michaelachrisco/readonly)\n\n\n# Laravel 5+ Read Only Models\nThe read only trait removes the ability to save, delete or modify Laravel models.\nIdeally, this would be used in addition to DB permissions to ensure users and developers cannot write to a Legacy system.\n\n## Install\n\n```\ncomposer require michaelachrisco/readonly\n```\n\n## To use:\n\n\n```php\n\u003c?php\nuse Illuminate\\Database\\Eloquent\\Model;\nuse MichaelAChrisco\\ReadOnly\\ReadOnlyTrait;\nclass User extends Model {\n  use ReadOnlyTrait;\n}\n\n$legacyUser = new User;\n$legacyUser-\u003eset_user_name('bob');\n\n$result = $legacyUser-\u003esave();\n//User is not saved. \n//ReadOnlyException is thrown.\n ?\u003e\n```\n\n## Methods that will throw ReadOnlyExceptions:\n\n * create\n * forceCreate\n * save\n * update\n * firstOrCreate\n * firstOrNew\n * delete\n * destroy\n * restore\n * forceDelete\n * performDeleteOnModel\n * push\n * finishSave\n * performUpdate\n * touch\n * insert\n * truncate\n * Add in a PR for any other methods you can find!\n\n###\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelachrisco%2Freadonlytraitlaravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelachrisco%2Freadonlytraitlaravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelachrisco%2Freadonlytraitlaravel/lists"}