File tree Expand file tree Collapse file tree 4 files changed +58
-1
lines changed
Expand file tree Collapse file tree 4 files changed +58
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Unisharp \Laravelfilemanager \Events ;
4+
5+ class ImageWasDeleted
6+ {
7+ private $ path ;
8+
9+ public function __construct ($ path )
10+ {
11+ $ this ->path = $ path ;
12+ }
13+
14+ /**
15+ * @return string
16+ */
17+ public function path ()
18+ {
19+ return $ this ->path ;
20+ }
21+
22+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Unisharp \Laravelfilemanager \Events ;
4+
5+ class ImageWasRenamed
6+ {
7+ private $ path ;
8+
9+ public function __construct ($ old_path , $ new_path )
10+ {
11+ $ this ->old_path = $ old_path ;
12+ $ this ->new_path = $ new_path ;
13+ }
14+
15+ /**
16+ * @return string
17+ */
18+ public function old_path ()
19+ {
20+ return $ this ->old_path ;
21+ }
22+
23+ public function new_path ()
24+ {
25+ return $ this ->new_path ;
26+ }
27+
28+ }
Original file line number Diff line number Diff line change 11<?php namespace Unisharp \Laravelfilemanager \controllers ;
22
3+ use Illuminate \Support \Facades \Event ;
34use Unisharp \Laravelfilemanager \controllers \Controller ;
45use Illuminate \Support \Facades \Config ;
56use Illuminate \Support \Facades \File ;
67use Illuminate \Support \Facades \Input ;
78use Lang ;
9+ use Unisharp \Laravelfilemanager \Events \ImageWasDeleted ;
810
911/**
1012 * Class CropController
@@ -41,7 +43,8 @@ public function getDelete()
4143 }
4244
4345 File::delete ($ file_to_delete );
44-
46+ Event::fire (new ImageWasDeleted ($ file_to_delete ));
47+
4548 if ('Images ' === $ this ->file_type ) {
4649 File::delete ($ thumb_to_delete );
4750 }
Original file line number Diff line number Diff line change 11<?php namespace Unisharp \Laravelfilemanager \controllers ;
22
3+ use Illuminate \Support \Facades \Event ;
34use Unisharp \Laravelfilemanager \controllers \Controller ;
45use Illuminate \Support \Facades \Config ;
56use Illuminate \Support \Facades \File ;
67use Illuminate \Support \Facades \Input ;
78use Illuminate \Support \Str ;
89use Lang ;
10+ use Unisharp \Laravelfilemanager \Events \ImageWasRenamed ;
911
1012/**
1113 * Class RenameController
@@ -37,6 +39,8 @@ public function getRename()
3739 return Lang::get ('laravel-filemanager::lfm.error-rename ' );
3840 }
3941
42+ Event::fire (new ImageWasRenamed ($ old_file , $ new_file ));
43+
4044 if (File::isDirectory ($ old_file )) {
4145 File::move ($ old_file , $ new_file );
4246 return 'OK ' ;
You can’t perform that action at this time.
0 commit comments