Download the PHP package kolirt/laravel-master-model without Composer
On this page you can find all versions of the php package kolirt/laravel-master-model. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-master-model
Laravel Master Model
Laravel Master Model is a powerful package for the Laravel framework that simplifies working with models, particularly in saving relations and uploading files.
This package is designed for developers who want to optimize the process of working with databases and files, reducing code complexity and enhancing performance.
Structure
- Getting started
- Requirements
- Installation
- Setup
- Console commands
- Use cases
- Saving files
- Saving files from third-party resources
- Deleting files
- Saving
HasOne
,MorphOne
relations - Saving
HasMany
,MorphMany
relations - Saving
HasMany
,MorphMany
relations withsync
mode - Saving
BelongsToMany
relation - Saving
BelongsToMany
relation withsync
mode - Response file
- FAQ
- License
- Other packages

Getting started
Requirements
- PHP >= 8.1
- Laravel >= 10
Installation
Setup
Publish config file
Use the MasterModel
trait in your models
Console commands
master-model:install
- Install master model packagemaster-model:publish-config
- Publish the config file
Use cases
Saving files
MasterModel automatically saves the file and deletes the old file, if it existed
You can specify folder and disk for each file
Saving files from third-party resources
You no longer need to worry about saving files from third-party resources, just put the response
and MasterModel will save everything for you
Deleting files
You can delete files by setting the field to null
To have files deleted automatically, delete data through the model, not through the builder, and don't forget to load the necessary relations in which you want to delete files
If there are files in the relationship and the relationship is deleted not through the model, the files won't be deleted and will clog up storage
Saving HasOne
, MorphOne
relations
You can save HasOne
, MorphOne
relations in the same way as a file. If relation exists, it will be updated, otherwise it will be created
You can also delete the relation by setting it to null
Saving HasMany
, MorphMany
relations
You can save HasMany
, MorphMany
relations in the same way as a file. If relations exists, it will be updated, otherwise it will be created
Saving HasMany
, MorphMany
relations with sync
mode
You can also sync HasMany
, MorphMany
relations. Unspecified relations will be deleted
Saving BelongsToMany
relation
Saving BelongsToMany
relation with sync
mode
You can sync the BelongsToMany
relation. Everything that is not specified when saving will be deleted
Response file
Use the responseFile
method to return a file in a controller
FAQ
Check closed issues to get answers for most asked questions
License
MIT
Other packages
Check out my other packages on my GitHub profile