Nova File Manager
website·Indexed 30 days ago
https://oneduo.github.io/nova-file-manager/A performant file management package for Laravel Nova. It includes a FileManager field and tool, featuring access control, upload validation, and integrations with Cropper.js and the Pintura image editor. Supports PHP 8.0 or higher and provides event dispatching for FileUploading and FileUploaded actions.
What's inside Nova File Manager
- Nova File Manager is a plug-and-play file management tool and field for Laravel Nova. It provides a customizable interface for managing assets across multiple disks and filesystems. Key capabilities include support for chunked uploads, local search, and the ability to save multiple assets within a single field. It is built using Tailwind CSS 3, Vue 3, and Vuex.
Overview of Nova File Manager for Laravel Nova
Nova File Manager is a plug-and-play file management tool and field for Laravel Nova. It provides a customizable interface for managing assets across multiple disks and filesystems.
Key technical specifications and features include:
- Compatibility: Laravel Nova 4 and PHP 8.
- Tech Stack: Built with Tailwind CSS 3, Vue 3, and Vuex.
- Capabilities: Supports chunked uploads, local search, and the ability to save multiple assets within a single field.
- Storage: Supports multi-disk and filesystem configurations.
Nova File Manager UI Overview
The Nova File Manager interface includes the following functional areas:
- Disk switcher dropdown
- Pagination control dropdown
- View mode toggle
- Global search bar
- New folder creation button
- File upload button
- Breadcrumbs for directory navigation
- Folders and Files lists
- Pagination controls
Dark mode support in Nova File Manager
The Nova File Manager tool natively supports dark mode and automatically synchronizes its appearance with the Laravel Nova color scheme settings.Integrate Pintura image editor into Nova File Manager
To integrate the Pintura image editor, first enable it in your.envfile. Because Pintura is a paid library, you must provide your own licensed JS and CSS assets. These assets must be loaded into your application before the File Manager tool scripts. The integration requires defining awindow.novaFileManagerEditorobject containing theappendDefaultEditorfunction and aneditorOptionsconfiguration object.NOVA_FILE_MANAGER_USE_PINTURA=true<!-- In layout.blade.php --> <head> <!-- ... --> <link rel="stylesheet" href="{{ asset('pintura.css') }}"> </head> <body> <!-- ... --> <script type="module"> import { appendDefaultEditor } from '/pintura.js' const editorOptions = {} window.novaFileManagerEditor = { appendDefaultEditor, editorOptions, } </script> @if ($scripts = \Laravel\Nova\Nova::availableScripts(request())) @foreach ($scripts as $asset) <script src="{!! $asset->url() !!}"></script> @endforeach @endif </body>Verify system requirements for Nova File Manager
To use the Nova File Manager package, ensure your environment meets the following minimum version requirements:
- PHP: 8.0 or higher
- Laravel Nova: 4.0 or higher
Nova File Manager System Requirements
To use Nova File Manager, ensure your environment meets the following minimum version requirements:
- PHP: 8.0+
- Laravel Nova: 4.0+
Manage Nova File Manager update notifications
The Nova File Manager package includes a built-in automatic update checker that displays a subtle banner when a new update is available.
Key behaviors:
- Default State: Enabled by default.
- Check Frequency: Checks for the latest release using a 1-hour cache.
- Dismissal: The banner will automatically dismiss after 1 day, or can be manually dismissed by updating the package and clearing the application cache.
To manually dismiss the update banner after updating the package, run the following command:
php artisan cache:clearIntegrate FileManager with third-party Nova tools
To use the
FileManagerfield inside custom fields or third-party tools (like Nova Settings or Flexible Content), you must register a wrapper in yourNovaServiceProvider. This ensures the field is correctly resolved during API calls.- Use the
wrapper('wrapper_name')method on the field. - Register the wrapper using
FileManager::registerWrapperin the provider'sregisterorbootmethod to apply configuration (like filesystems or permissions). - Ensure the attribute is cast correctly (e.g., using
AssetCollection::class).
// In NovaServiceProvider.php public function boot() { NovaSettings::addSettingsFields(function () { return [ FileManager::make('An image', 'image') ->wrapper('my_wrapper'), ]; }, [ 'image' => AssetCollection::class, ]); } public function register() { FileManager::registerWrapper('my_wrapper', function (FileManager $field) { return $field ->multiple() ->filesystem(fn() => 'public'); }); }- Use the
Handle Nova File Manager events
The Nova File Manager dispatches events to an event bus when specific file or folder actions are performed. You can subscribe to these events by adding a listener to the event bus. For 'before' hooks (events ending in -ing), you can prevent the action from proceeding by throwing aValidationException.Run Nova File Manager from a local fork
To contribute to the package and run it on a local Laravel Nova installation, fork the repository and add your fork's URL to therepositoriessection of your project'scomposer.jsonfile.{ "repositories": [ { "type": "git", "url": "<your-fork-repository-git-url>" } ] }Install Nova File Manager via Composer
Install theoneduo/nova-file-managerpackage using Composer to add file management capabilities to your Nova project.composer require oneduo/nova-file-manager