This project provides examples on how to use the eventing system with laravel-filemanager.
- Clone and cd into this project
make init
php artisan serve
- Go to your browser and visit
localhost:8000/laravel-filemanager/demo
This event is fired before an image is saved. The event listener in App\Listeners\IsUploadingImageListener does the following:
- Checks if hte user is currently logged in, if not aborts the request.
Note: If you are using this example project you are automatically logged in, try playing around with it
This event is fired before an image is saved. The event listener in App\Listeners\HasUploadedImageListener does the following:
- Extracts the file path of the file that was just uploaded
- Saves the file path to the database
This event is fired before an image is deleted. The event listener in App\Listeners\DeleteImageListener does the following:
- Extracts the file path of the file that is to be deleted
- Searches the database for the file path
- If a reference is found, formats a message and aborts the request
This event is fired just before an image is renamed. The event listener in App\Listeners\RenameImageListener does the following:
- Extracts the old and new file path
- Searches the database for the old path
- Updates all records containing the old path
Remeber to run make test
, make sure all tests are passed before sending new pull requests.