Skip to content

celxkodez/laravel-model-file-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-model-file-manager

Latest Version on Packagist Total Downloads Latest Unstable Version License PHP Version Require

A Laravel Package for handling file upload associated with model with ease

Installation

PHP 7.3+ and Composer are required.

To get the latest version of Laravel model file manager, simply require it

composer require celxkodez/laravel-model-file-manager

Or add the following line to the require block of your composer.json file.

"celxkodez/laravel-model-file-manager": "1.0.*"

You'll then need to run composer install or composer update to download it and have the autoloader updated.

Configuration

You can publish the configuration file using this command:

php artisan vendor:publish --provider="Celxkodez\LaravelModelFileManager\LaravelModelFileManagerServiceProvider"

A configuration-file named modelfilemanager.php with some sensible defaults will be placed in your config directory:

<?php

return [

    /**
     * Cloudinary Url
     *
     */
    'cloudinary_url' => getenv('CLOUDINARY_URL', ''),
];

Usage

On your Model, add the HasUploadField trait.

use Celxkodez\LaravelModelFileManager\Traits\HasUploadField;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use HasUploadField;
}

On Controller or anywhere with uploaded file

Post::create([
    ...
    'image' => request('file')
    ...
]);

Contributing

Please see CONTRIBUTING for details.

The Big “Thank You”!

Please Star the repo and share across your network. that would be so nice!

And also don't forget to follow me on twitter!

Thanks Again! Celestine Stephen.

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages