Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/Events/ImageWasDeleted.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Unisharp\Laravelfilemanager\Events;

class ImageWasDeleted
{
private $path;

public function __construct($path)
{
$this->path = $path;
}

/**
* @return string
*/
public function path()
{
return $this->path;
}

}
28 changes: 28 additions & 0 deletions src/Events/ImageWasRenamed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Unisharp\Laravelfilemanager\Events;

class ImageWasRenamed
{
private $path;

public function __construct($old_path, $new_path)
{
$this->old_path = $old_path;
$this->new_path = $new_path;
}

/**
* @return string
*/
public function old_path()
{
return $this->old_path;
}

public function new_path()
{
return $this->new_path;
}

}
5 changes: 4 additions & 1 deletion src/controllers/DeleteController.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php namespace Unisharp\Laravelfilemanager\controllers;

use Illuminate\Support\Facades\Event;
use Unisharp\Laravelfilemanager\controllers\Controller;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Input;
use Lang;
use Unisharp\Laravelfilemanager\Events\ImageWasDeleted;

/**
* Class CropController
Expand Down Expand Up @@ -41,7 +43,8 @@ public function getDelete()
}

File::delete($file_to_delete);

Event::fire(new ImageWasDeleted($file_to_delete));

if ('Images' === $this->file_type) {
File::delete($thumb_to_delete);
}
Expand Down
4 changes: 4 additions & 0 deletions src/controllers/RenameController.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php namespace Unisharp\Laravelfilemanager\controllers;

use Illuminate\Support\Facades\Event;
use Unisharp\Laravelfilemanager\controllers\Controller;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Str;
use Lang;
use Unisharp\Laravelfilemanager\Events\ImageWasRenamed;

/**
* Class RenameController
Expand Down Expand Up @@ -37,6 +39,8 @@ public function getRename()
return Lang::get('laravel-filemanager::lfm.error-rename');
}

Event::fire(new ImageWasRenamed($old_file, $new_file));

if (File::isDirectory($old_file)) {
File::move($old_file, $new_file);
return 'OK';
Expand Down