From 8ffe49ae2b0b371c40563c37c0356ec484ff2ee9 Mon Sep 17 00:00:00 2001 From: StreamHuang Date: Wed, 3 Aug 2016 20:18:58 +0800 Subject: [PATCH] update readme and document --- README.md | 51 ++++++-------------------------------------- doc/config.md | 2 ++ doc/customization.md | 2 ++ doc/events.md | 44 ++++++++++++++++++++++++++++++++++++++ doc/installation.md | 2 ++ doc/integration.md | 2 ++ doc/upgrade.md | 14 ++++++++++++ 7 files changed, 72 insertions(+), 45 deletions(-) create mode 100644 doc/events.md create mode 100644 doc/upgrade.md diff --git a/README.md b/README.md index ffd5fa9f..861f2ade 100644 --- a/README.md +++ b/README.md @@ -21,63 +21,24 @@ PR is welcome! 1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md) 1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md) 1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md) - -## Upgrade guide - * `composer update unisharp/laravel-filemanager` - * `php artisan vendor:publish --tag=lfm_view --force` - * `php artisan vendor:publish --tag=lfm_config --force` (IMPORTANT: please backup your own `config/lfm.php` first) + 1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md) + 1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md) ## Screenshots * Independent usage example : -![Independent usage example](http://unisharp.github.io/images/lfm01.png) +![Independent usage example](https://raw.githubusercontent.com/UniSharp/laravel-filemanager/gh_pages/images/lfm01.png) * List view : -![FileManager screenshot 1](http://unisharp.com/img/filemanager1.png) +![FileManager screenshot 1](https://raw.githubusercontent.com/UniSharp/laravel-filemanager/gh_pages/images/lfm02.png) * Grid view : -![FileManager screenshot 2](http://unisharp.com/img/filemanager2.png) - -## Events - -To use events you can add a listener to listen to the events - -Snippet for `EventServiceProvider` -```php - protected $listen = [ - ImageWasUploaded::class => [ - UploadListener::class, - ], - ]; -``` - -The `UploadListener` will look like: -```php -class UploadListener -{ - public function handle($event) - { - $method = 'on'.class_basename($event); - if (method_exists($this, $method)) { - call_user_func([$this, $method], $event); - } - } - - public function onImageWasUploaded(ImageWasUploaded $event) - { - $path = $event->path(); - //your code, for example resizing and cropping - } -} -``` - -List of events: - * Unisharp\Laravelfilemanager\Events\ImageWasUploaded +![FileManager screenshot 2](https://raw.githubusercontent.com/UniSharp/laravel-filemanager/gh_pages/images/lfm03.png) ## Credits - * All contibutors from GitHub. (issues / PR) + * [All contibutors](https://github.com/UniSharp/laravel-filemanager/graphs/contributors) from GitHub. (issues / PR) * Special thanks to * [@taswler](https://github.com/tsawler) the original author. * [@olivervogel](https://github.com/olivervogel) for the awesome [image library](https://github.com/Intervention/image) diff --git a/doc/config.md b/doc/config.md index 1a35272e..c7237787 100644 --- a/doc/config.md +++ b/doc/config.md @@ -4,6 +4,8 @@ 1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md) 1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md) 1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md) + 1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md) + 1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md) ## Config diff --git a/doc/customization.md b/doc/customization.md index 9ff38b1a..c7028360 100644 --- a/doc/customization.md +++ b/doc/customization.md @@ -4,6 +4,8 @@ 1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md) 1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md) 1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md) + 1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md) + 1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md) ## Customization diff --git a/doc/events.md b/doc/events.md new file mode 100644 index 00000000..1b688e92 --- /dev/null +++ b/doc/events.md @@ -0,0 +1,44 @@ +## Documents + + 1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md) + 1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md) + 1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md) + 1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md) + 1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md) + 1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md) + +## List of events + * Unisharp\Laravelfilemanager\Events\ImageWasUploaded + +## How to use + +To use events you can add a listener to listen to the events + +Snippet for `EventServiceProvider` +```php + protected $listen = [ + ImageWasUploaded::class => [ + UploadListener::class, + ], + ]; +``` + +The `UploadListener` will look like: +```php +class UploadListener +{ + public function handle($event) + { + $method = 'on'.class_basename($event); + if (method_exists($this, $method)) { + call_user_func([$this, $method], $event); + } + } + + public function onImageWasUploaded(ImageWasUploaded $event) + { + $path = $event->path(); + //your code, for example resizing and cropping + } +} +``` diff --git a/doc/installation.md b/doc/installation.md index b38d53a2..5de1692a 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -4,6 +4,8 @@ 1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md) 1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md) 1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md) + 1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md) + 1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md) ## Requirements diff --git a/doc/integration.md b/doc/integration.md index 0de3d64e..c583c0c3 100644 --- a/doc/integration.md +++ b/doc/integration.md @@ -4,6 +4,8 @@ 1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md) 1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md) 1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md) + 1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md) + 1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md) ## WYSIWYG Editor Integration: ### Option 1: CKEditor diff --git a/doc/upgrade.md b/doc/upgrade.md new file mode 100644 index 00000000..f0b020b3 --- /dev/null +++ b/doc/upgrade.md @@ -0,0 +1,14 @@ +## Documents + + 1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md) + 1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md) + 1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md) + 1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md) + 1. [Events](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/events.md) + 1. [Upgrade](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/upgrade.md) + +## Upgrade guide + * `composer update unisharp/laravel-filemanager` + * `php artisan vendor:publish --tag=lfm_view --force` + * `php artisan vendor:publish --tag=lfm_config --force` (IMPORTANT: please backup your own `config/lfm.php` first) +