You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.5 KiB
PHP
48 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Auth;
|
|
use Yo;
|
|
use Login;
|
|
|
|
class AuthController extends Controller
|
|
{
|
|
public function list()
|
|
{
|
|
Login::admin(5);
|
|
$page_group = Auth::select('id', 'title')
|
|
->where('type', 1)->where('del', 2)
|
|
->orderBy('order', 'desc')->get();
|
|
$page_list = [];
|
|
foreach ($page_group as $item) {
|
|
$page_auth_list = Auth::select('id', 'title')->where('pid', $item->id)
|
|
->where('type', 2)->where('check_type', 2)->where('del', 2)
|
|
->orderBy('order', 'desc')->get();
|
|
if (count($page_auth_list) !== 0) $page_list[] = [
|
|
"id" => $item->id,
|
|
"title" => $item->title,
|
|
"children" => $page_auth_list
|
|
];
|
|
}
|
|
$api_group = Auth::select('id', 'title')
|
|
->where('type', 3)->where('del', 2)
|
|
->orderBy('order', 'desc')->get();
|
|
$api_list = [];
|
|
foreach ($api_group as $item) {
|
|
$api_auth_list = Auth::select('id', 'title')->where('pid', $item->id)
|
|
->where('type', 4)->where('check_type', 2)->where('del', 2)
|
|
->orderBy('order', 'desc')->get();
|
|
if (count($api_auth_list) !== 0) $api_list[] = [
|
|
"id" => $item->id,
|
|
"title" => $item->title,
|
|
"children" => $api_auth_list
|
|
];
|
|
}
|
|
return Yo::echo([
|
|
'page' => $page_list,
|
|
'api' => $api_list,
|
|
]);
|
|
}
|
|
}
|