roopchandkashyap/laravel-eloquent-files-with-aws-s3

File Handling with Eloquent Models and AWS Bucket S3 in Laravel

Downloads

24

Stars

0

Version

Eloquent Files with AWS storage S3 Bucket Config

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
roopchandkashyap

Author

roopchandkashyap