Spatie Model File Manager using Livewire and FilePond

Tech Stack: tailwindcss, alpine-js, livewire

Demo

Please login to check demo of Livewire File Manager

Code

Sorry, this component's code is restricted
Get Livewiredemos-Pro
Sorry, this component's code is restricted
Get Livewiredemos-Pro
Sorry, this component's code is restricted
Get Livewiredemos-Pro

Usage

Pass in the model for which you want to manage the files as the parameter of the component.

In the below example we are looking to manage the files of a logged-in user, so we pass in the user object.


      @livewire('model-file-manager', ['model' => \Auth::user()])
    

Documentation

In Model Media Manager livewire component we use Spatie Media Librarypackage to manage the files.

Thus in order to use this component, you must first install the Spatie media library package using Composer.


composer require "spatie/laravel-medialibrary:^9.0.0"

Preparing your models

To associate media with a model, the model must implement the interface and trait as shown above in the Model Tab:

Once you have your Model ready, you can just pass in the object of the Model to the livewire component for which you want to manage the files, and it should just work!