roopchandkashyap / laravel-eloquent-files-with-aws-s3
File Handling with Eloquent Models and AWS Bucket S3 in Laravel
dev-master
2019-04-30 04:27 UTC
Requires
- laravel/framework: ^5.4
This package is auto-updated.
Last update: 2024-04-29 03:51:26 UTC
README
Installation using Composer:
composer require roopchandkashyap/laravel-eloquent-files-with-aws-s3
Usage:
In your eloquent model use \roopchandkashyap\EloquentFiles\HasFile
trait and create a method for accessing file like below:
<?php namespace App\Model; use Illuminate\Database\Eloquent\Model; class Member extends Model { use \roopchandkashyap\EloquentFiles\HasFile; function getImageAttribute() { return $this->file_info("image_path"); } }
Here "image_path"
is the attribute/column name on which you want to assign the path of the uploaded file, default is "file_path".
The second argument accepted by the file_info()
method is the array of the following options.
Name | Value |
---|