LaravelPackages.net
Acme Inc.
Toggle sidebar
shridharkaushik29/laravel-eloquent-files

File Handling with Eloquent Models in Laravel

283
0
2.0.0
About shridharkaushik29/laravel-eloquent-files

shridharkaushik29/laravel-eloquent-files is a Laravel package for file handling with eloquent models in laravel. It currently has 0 GitHub stars and 283 downloads on Packagist (latest version 2.0.0). Install it with composer require shridharkaushik29/laravel-eloquent-files. Discover more Laravel packages by shridharkaushik29 or browse all Laravel packages to compare alternatives.

Last updated

Eloquent Files

Installation using Composer:

composer require shridharkaushik29/laravel-eloquent-files

Usage:

In your eloquent model use \Shridhar\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 \Shridhar\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
Comments