PermissionController.php
839 Bytes
<?php
namespace App\Http\Container\AppSection\Controllers\Auth;
use App\Helpers\JsonResource;
use App\Http\Service\UserService;
use App\Support\Controller;
use App\Traits\UserTrait;
use Auth;
use Illuminate\Http\JsonResponse;
class PermissionController extends Controller
{
use UserTrait;
/**
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(): JsonResponse
{
$this->user = Auth::user();
return JsonResource::success(JsonResource::SUCCESS, [
'demo' => (int)UserService::hasDemoPermission($this->user),
'sing' => (int)UserService::hasSingPermission($this->user),
'listen' => (int)UserService::hasListenPermission($this->user),
'is_white' => (int)UserService::inSingOrListenWhite($this->user),
]);
}
}