30 lines
592 B
PHP
30 lines
592 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Services\AuthService;
|
|
use Illuminate\Http\Request;
|
|
|
|
class AuthenticationController extends Controller
|
|
{
|
|
private $authService;
|
|
|
|
public function __construct(AuthService $authService)
|
|
{
|
|
$this->authService = $authService;
|
|
}
|
|
|
|
public function isAuthenticated()
|
|
{
|
|
return [
|
|
'status' => $this->authService->isAuthenticated()
|
|
];
|
|
}
|
|
|
|
public function requestAuthentication()
|
|
{
|
|
$token = $this->authService->generateToken();
|
|
return response()->json($token);
|
|
}
|
|
}
|