|
|
|
|
@ -13,9 +13,12 @@ class AdminAuthController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function create(EditAdminAuth $request)
|
|
|
|
|
{
|
|
|
|
|
Login::admin([8]);
|
|
|
|
|
Login::admin(['config-router']);
|
|
|
|
|
$name = $request->post('name');
|
|
|
|
|
$check_info = AdminAuth::where('name', $name)->where('del', 2)->first();
|
|
|
|
|
if (!!$check_info) Yo::error_echo(100033);
|
|
|
|
|
$admin_auth = new AdminAuth();
|
|
|
|
|
$admin_auth->name = $request->post('name');
|
|
|
|
|
$admin_auth->name = $name;
|
|
|
|
|
$admin_auth->title = $request->post('title');
|
|
|
|
|
$admin_auth->icon = $request->post('icon') ?? '';
|
|
|
|
|
$pid = $request->post('pid');
|
|
|
|
|
@ -41,9 +44,13 @@ class AdminAuthController extends Controller
|
|
|
|
|
|
|
|
|
|
public function update(EditAdminAuth $request)
|
|
|
|
|
{
|
|
|
|
|
Login::admin([8]);
|
|
|
|
|
$admin_auth = AdminAuth::where('id', $request->post('id'))->where('del', 2)->first();
|
|
|
|
|
Login::admin(['config-router']);
|
|
|
|
|
$id = $request->post('id');
|
|
|
|
|
$admin_auth = AdminAuth::where('id', $id)->where('del', 2)->first();
|
|
|
|
|
if (!$admin_auth) Yo::error_echo(100001, ['路由']);
|
|
|
|
|
$name = $request->post('name');
|
|
|
|
|
$check_info = AdminAuth::where('name', $name)->where('id', '!=', $id)->where('del', 2)->first();
|
|
|
|
|
if (!!$check_info) Yo::error_echo(100033);
|
|
|
|
|
$admin_auth->name = $request->post('name');
|
|
|
|
|
$admin_auth->title = $request->post('title');
|
|
|
|
|
$admin_auth->icon = $request->post('icon') ?? '';
|
|
|
|
|
@ -70,7 +77,7 @@ class AdminAuthController extends Controller
|
|
|
|
|
|
|
|
|
|
public function delete(Request $request)
|
|
|
|
|
{
|
|
|
|
|
Login::admin([8]);
|
|
|
|
|
Login::admin(['config-router']);
|
|
|
|
|
$admin_auth = AdminAuth::where('id', $request->post('id'))->where('del', 2)->first();
|
|
|
|
|
if (!$admin_auth) Yo::error_echo(100001, ['路由']);
|
|
|
|
|
$son_count = AdminAuth::where('pid', $admin_auth->id)->where('del', 2)->count();
|
|
|
|
|
@ -82,7 +89,7 @@ class AdminAuthController extends Controller
|
|
|
|
|
|
|
|
|
|
public function list(Request $request)
|
|
|
|
|
{
|
|
|
|
|
Login::admin([8]);
|
|
|
|
|
Login::admin(['config-router']);
|
|
|
|
|
$auth_group = AdminAuth::where('pid', 0)->where('type', 1)->where('del', 2)->orderBy('order', 'desc')->get();
|
|
|
|
|
$list = [];
|
|
|
|
|
foreach ($auth_group as $item) {
|
|
|
|
|
@ -101,7 +108,7 @@ class AdminAuthController extends Controller
|
|
|
|
|
|
|
|
|
|
public function select(Request $request)
|
|
|
|
|
{
|
|
|
|
|
Login::admin([8]);
|
|
|
|
|
Login::admin(['config-router']);
|
|
|
|
|
$auth_group = AdminAuth::where('pid', 0)->where('type', 1)->where('del', 2)->orderBy('order', 'desc')->get();
|
|
|
|
|
return Yo::echo([
|
|
|
|
|
'list' => $auth_group
|
|
|
|
|
|