File tree Expand file tree Collapse file tree 5 files changed +73
-8
lines changed
Expand file tree Collapse file tree 5 files changed +73
-8
lines changed Original file line number Diff line number Diff line change 22
33All Notable changes to ` laravel-uploadable ` will be documented in this file
44
5+ ## 3.1.0 - 2019-04-24
6+ ### ADD
7+ - Events for upload and delete upload successfull.
8+ - Back compatibility to laravel 5.0 in composer.json.
9+
10+
511## 3.0.2 - 2018-10-28
612### CHANGE
713- readme.md
Original file line number Diff line number Diff line change 1717 ],
1818 "require" : {
1919 "php" : " >=7.0.0" ,
20- "illuminate/http" : " ^5.7" ,
21- "illuminate/database" : " ^5.7" ,
22- "illuminate/support" : " ^5.7" ,
20+ "illuminate/http" : " ^5.0|^5. 7" ,
21+ "illuminate/database" : " ^5.0|^5. 7" ,
22+ "illuminate/support" : " ^5.0|^5. 7" ,
2323 "padosoft/io" : " ^1.0" ,
24- "padosoft/laravel-request" : " ^2.0" ,
25- "padosoft/support" : " ^2.1"
24+ "padosoft/laravel-request" : " ^1.0|^ 2.0" ,
25+ "padosoft/support" : " ^1.6|^ 2.1"
2626 },
2727 "require-dev" : {
28- "orchestra/testbench" : " ^3.7" ,
29- "phpunit/phpunit" : " ^7.0" ,
28+ "orchestra/testbench" : " ^3.2|^3. 7" ,
29+ "phpunit/phpunit" : " ^5.0|^ 7.0" ,
3030 "mockery/mockery" : " ^0.9.5" ,
31- "padosoft/test" : " ^1.0.1"
31+ "padosoft/test" : " ^0.2.2|^ 1.0.1"
3232 },
3333 "autoload" : {
3434 "psr-4" : {
Original file line number Diff line number Diff line change 1+ <?php
2+
3+
4+ namespace Padosoft \Uploadable \Events ;
5+
6+ use Illuminate \Database \Eloquent \Model ;
7+
8+ class UploadDeleteExecuted
9+ {
10+ /**
11+ * @var String
12+ */
13+ public $ attributeName ;
14+ /**
15+ * @var String
16+ */
17+ public $ attributeValue ;
18+ /**
19+ * @var Model
20+ */
21+ public $ target ;
22+
23+ public function __construct ($ attributeName , $ attributeValue , $ target )
24+ {
25+ $ this ->attributeName = $ attributeName ;
26+ $ this ->attributeValue = $ attributeValue ;
27+ $ this ->target = $ target ;
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+
4+ namespace Padosoft \Uploadable \Events ;
5+
6+ use Illuminate \Database \Eloquent \Model ;
7+
8+ class UploadExecuted
9+ {
10+ /**
11+ * @var String
12+ */
13+ public $ attributeName ;
14+ /**
15+ * @var Model
16+ */
17+ public $ target ;
18+
19+ public function __construct ($ attributeName , $ target )
20+ {
21+ $ this ->attributeName = $ attributeName ;
22+ $ this ->target = $ target ;
23+ }
24+ }
Original file line number Diff line number Diff line change 1111use Padosoft \Io \FileHelper ;
1212use Padosoft \Laravel \Request \RequestHelper ;
1313use Padosoft \Laravel \Request \UploadedFileHelper ;
14+ use Padosoft \Uploadable \Events \UploadDeleteExecuted ;
1415
1516/**
1617 * Class Uploadable
@@ -323,11 +324,16 @@ public function setBlanckAttributeAndDB(string $uploadField)
323324 return ;
324325 }
325326
327+ //old value
328+ $ old = $ this ->{$ uploadField };
329+
326330 //set to black attribute
327331 $ this ->{$ uploadField } = '' ;
328332
329333 //save on db (not call model save because invoke event and entering in loop)
330334 $ this ->updateDb ($ uploadField , '' );
335+
336+ event (new UploadDeleteExecuted ($ uploadField , $ old , $ this ));
331337 }
332338
333339 /**
You can’t perform that action at this time.
0 commit comments