add event PluginWasDeleted

This commit is contained in:
printempw 2016-11-19 22:02:02 +08:00
parent 0d006dac66
commit d2a2b81652
3 changed files with 30 additions and 2 deletions

View File

@ -0,0 +1,21 @@
<?php
namespace App\Events;
use App\Services\Plugin;
class PluginWasDeleted extends Event
{
public $plugin;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Plugin $plugin)
{
$this->plugin = $plugin;
}
}

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use View;
use Utils;
use Option;
use App\Events;
use App\Models\User;
use App\Models\Player;
use App\Models\Texture;
@ -117,14 +118,20 @@ class AdminController extends Controller
switch ($request->get('action')) {
case 'enable':
$plugins->enable($id);
return redirect('admin/plugins');
break;
case 'disable':
$plugins->disable($id);
return redirect('admin/plugins');
break;
case 'delete':
if ($request->isMethod('post')) {
event(new Events\PluginWasDeleted($plugin));
$plugins->uninstall($id);
return json('插件已被成功删除', 0);

View File

@ -51,11 +51,11 @@ class CheckAuthenticated
exit;
}
event(new UserAuthenticated($user));
if ($return_user)
return $user;
event(new UserAuthenticated($user));
return $next($request);
} else {
return redirect('auth/login')->with('msg', trans('auth.check.anonymous'));