AuthController.php
904 Bytes
<?php
namespace App\Http\Container\UserSection\Controllers;
use App\Http\Service\UserService;
use App\Models\SystemPermission;
use Auth;
use Hikoon\LaravelApi\Facades\Response;
use Hikoon\LaravelApi\Support\ApiController;
use Illuminate\Http\Request;
class AuthController extends ApiController
{
/**
* @param \Illuminate\Http\Request $request
* @return \Hikoon\LaravelApi\Facades\Response
*/
public function show(Request $request): Response
{
return $this->successWithData([
'user' => $request->user()->only(['id', 'nick_name', 'avatar']),
'permissions' => SystemPermission::filter(['guard' => 'User'])->pluck('name'),
'menus' => SystemPermission::filter(['guard' => 'User'])->latest('weight')->get(),
'can_create_demo' => (int)UserService::hasDemoPermission(Auth::user())
]);
}
}