PHP code example of roui / model-file-manager

1. Go to this page and download the library: Download roui/model-file-manager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

roui / model-file-manager example snippets




return [
    'storage_disk' => env('MODEL_FILE_STORAGE_DISK', 'public'),
    'resized_image_path' => env('RESIZED_IMAGE_PATH', 'resized/{width}x{height}'),
    'default_collection' => env('DEFAULT_FILE_COLLECTION', 'default'),
];

   $user->uploadFile($file, 'profile_pictures');
   

   $user->deleteFile('path/to/file.jpg', 'profile_pictures');
   

   $files = $user->getFiles();
   

   $files = $user->getFilesFromCollection('profile_pictures', 300, 300);
   

   $user->replaceFileInCollection($newFile, 'profile_pictures');
   

   $resizedUrl = $user->getResizedImage('path/to/file.jpg', 300, 300);
   

   $files = $user->files; // Returns array of files
   
bash
   php artisan vendor:publish --tag=config