A Laravel Package for handling file upload associated with model with ease
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.
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', ''),
];
use Celxkodez\LaravelModelFileManager\Traits\HasUploadField;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasUploadField;
}
Post::create([
...
'image' => request('file')
...
]);
Please see CONTRIBUTING for details.
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.
The MIT License (MIT). Please see License File for more information.