Skip to content

Commit

Permalink
file events
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyMiracle committed Sep 27, 2019
1 parent b6c7292 commit 2cf3b20
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/UploadableFileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static function save(string $directory, UploadedFile $file, string $filen
try {
$path = Storage::disk($disk ?? config('uploadable.disk'))
->putFileAs($directory, $file, $filename);
event('uploadable.file.uploaded', ['path' => $path]);
} catch (Exception $e) {
throw new FileException($e->getMessage());
}
Expand All @@ -40,6 +41,8 @@ public static function save(string $directory, UploadedFile $file, string $filen
*/
public static function delete(string $file, $disk = null): bool
{
event('uploadable.file.deleted', ['path' => $file]);

return Storage::disk($disk ?? config('uploadable.disk'))->delete($file);
}
}

0 comments on commit 2cf3b20

Please sign in to comment.