Download the PHP package esign/laravel-model-files without Composer
On this page you can find all versions of the php package esign/laravel-model-files. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download esign/laravel-model-files
More information about esign/laravel-model-files
Files in esign/laravel-model-files
Package laravel-model-files
Short Description Associate files with your Laravel Models
License MIT
Homepage https://github.com/esign/laravel-model-files
Informations about the package laravel-model-files
Associate files with your Laravel Models
This package allows you to store files for models in an opinionated way.
Installation
You can install the package via composer:
Usage
Preparing your model
To associate files with your model you need to use the Esign\ModelFiles\Concerns\HasFiles
trait on the model.
The database structure should look like the following:
Configuring the disk
By default, the files will be associated with the default disk configured in your config/filesystems.php
file.
You may override this by defining the getFileDisk
method on your model.
Storing files
To store files you may use the storeFile
method.
This method accepts instances of both the Illuminate\Http\File
and Illuminate\Http\UploadedFile
classes.
Retrieving file info
Deleting files
Using with underscore translatable
This package ships with support for the underscore translatable package.
Make sure to include the file, filename and mime columns within the translatable
array:
Next up, your migrations should look like the following:
You may now use the internal methods using the default or the specific locale:
Testing
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-model-files with dependencies
esign/laravel-underscore-translatable Version ^1.4
illuminate/http Version ^8.74|^9.0|^10.0|^11.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0