dev-master
9999999-devFile Handling with Eloquent Models in Laravel
MIT
The Requires
by Shridhar Sharma
1.0.0
1.0.0.0File Handling with Eloquent Models in Laravel
MIT
The Requires
by Shridhar Sharma
File Handling with Eloquent Models in Laravel
Installation using Composer:, (*1)
composer require shridharkaushik29/laravel-eloquent-files
, (*2)
Usage:, (*3)
In your eloquent model use \Shridhar\EloquentFiles\HasFile
trait and create a method for accessing file like below:, (*4)
<?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"., (*5)
The second argument accepted by the file_info()
method is the array of the following options., (*6)
Name | Value |
---|---|
File Handling with Eloquent Models in Laravel
MIT
File Handling with Eloquent Models in Laravel
MIT