https://github.com/bedoke/model-repositories
Laravel package for connecting Models with file repositories. It ensures that your models get their own storage directories and functions.
https://github.com/bedoke/model-repositories
laravel laravel-5-package repository storage
Last synced: about 2 months ago
JSON representation
Laravel package for connecting Models with file repositories. It ensures that your models get their own storage directories and functions.
- Host: GitHub
- URL: https://github.com/bedoke/model-repositories
- Owner: bedoke
- Created: 2019-07-12T06:58:43.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-06T09:26:55.000Z (almost 7 years ago)
- Last Synced: 2025-06-18T23:43:34.265Z (about 1 year ago)
- Topics: laravel, laravel-5-package, repository, storage
- Language: PHP
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Description
This package ensures that your models get their own storage directories.
# Install
## Get the package
composer require bedoke/model-repositories
## Extend the subjected model classes
use bedoke\ModelRepositories\Traits\PublicRepository; // for public repositories
use bedoke\ModelRepositories\Traits\PrivateRepository; // for private repositories
All models can have both repository types!
Inside the model classes you have to use the traits.
use PublicRepository, PrivateRepository;
## Migration
php artisan migrate
# Usage
## Functions
The private and public repository has almost all the storage functions that the Laravel Framework provides.
Example for the Laravel standard:
Storage::put($file, $content);
Example for this Model repositories package:
Auth::user()->privateRepository->put($file, $content);
Some functions must have different names due to the inheritance hierarchies.
The following storage function calls have the following names via this repository package:
Storage::append() --> $repository->appendContent()
Storage::prepend() --> $repository->prependContent()
Storage::delete() --> $repository->remove()
Some functions (for example move() or rename()) are not implemented yet.
Feel free to implement them and make a pull request.