LaravelPackages.net
Acme Inc.
Toggle sidebar
celxkodez/laravel-model-file-manager

manage file upload on model fields

31
5
1.0.1
About celxkodez/laravel-model-file-manager

celxkodez/laravel-model-file-manager is a Laravel package for manage file upload on model fields. It currently has 5 GitHub stars and 31 downloads on Packagist (latest version 1.0.1). Install it with composer require celxkodez/laravel-model-file-manager. Discover more Laravel packages by celxkodez or browse all Laravel packages to compare alternatives.

Last updated

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.

Comments