forked from projects/fipamo
37 lines
862 B
PHP
37 lines
862 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers\API;
|
||
|
|
||
|
use App\Http\Controllers\Controller;
|
||
|
use App\Services\AuthService;
|
||
|
use Illuminate\Http\Request;
|
||
|
|
||
|
class AuthAPIController extends Controller
|
||
|
{
|
||
|
public function __construct(
|
||
|
AuthService $authService
|
||
|
) {
|
||
|
$this->auth = $authService;
|
||
|
}
|
||
|
|
||
|
public function status(Request $request)
|
||
|
{
|
||
|
$result = [];
|
||
|
$data = json_decode($request->getContent());
|
||
|
if ($this->auth::status()) {
|
||
|
$result = [
|
||
|
'message' => 'Authorized',
|
||
|
'type' => 'apiUseAuthorized',
|
||
|
'token' => session('token'),
|
||
|
];
|
||
|
} else {
|
||
|
$result = [
|
||
|
'message' => 'Not Authorized',
|
||
|
'type' => 'apiUseNotAuthorized',
|
||
|
];
|
||
|
}
|
||
|
|
||
|
return response()->json($result);
|
||
|
}
|
||
|
}
|