mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-15 06:09:58 +08:00
add event PluginWasDeleted
This commit is contained in:
parent
0d006dac66
commit
d2a2b81652
21
app/Events/PluginWasDeleted.php
Normal file
21
app/Events/PluginWasDeleted.php
Normal 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;
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
|
@ -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'));
|
||||
|
Loading…
Reference in New Issue
Block a user