codefun / filemanager
Laravel File Manager For Main All Types of file upload
v1.0.2
2024-07-26 10:24 UTC
Requires
- php: ^7.3|^8.0
- intervention/image: ^3.3
This package is auto-updated.
Last update: 2025-06-26 16:51:16 UTC
README
- This package will automatically handel your all files for upload, update & delete.
Installation Process
composer require codefun/filemanager
php artisan vendor:publish --tag=codefun_fileManager_migration
php artisan migrate
Before Laravel 5.7
Add the following into your providers array on config\app.php
:
CodeFun\Activitylog\App\Providers\FileManagerServiceProvider
then add This alias into alias array on config\app.php
:
"FileManager" => CodeFun\Activitylog\Facade\FileManager::class
Not necessary from Laravel 5.7 onwards
How To Upload File?
In your method Just Use it Available methods
$user = User::find($id);
FileManager::model($user)->upload($fileName, $width = null, $height = null);
FileManager::coverPic()->upload($fileName, $width = null, $height = null);
FileManager::profilePic()->upload($fileName, $width = null, $height = null);
FileManager::deleteAll(Model $model);
FileManager::model($user)->delete(array | string $deleteAbleFileId);
FileManager::model($user)->update(array | string $updateAbleFileId)->upload($fileName, $width = null, $height = null);
Go to your Model and use the trait file:
use CodeFun\FileManager\App\Component\Traits\FileManager;
class AnyModel extends Model
{
use FileManager;
}
Retrive Multiple Uploaded Files without cover & profice pic
$user = User::find(1);
$user->files() [ This Method Return File List(Array List)]
Retrive All Uploaded Files
$user = User::find(1);
$user->allFiles() [ This Method Return File List(Array List)]
Retrive profile Pic
$user = User::find(1);
$user->profilePic() [ This Method Return single File ]