ro
064407aa88
a class for members was needed for long term handling of member functions like login, update, status checking, etc so that class was created and the AuthService class was removed as it was redundant and it's functionaity moved to the member class
39 lines
918 B
PHP
39 lines
918 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Interfaces\MemberRepositoryInterface;
|
|
use Illuminate\Http\Request;
|
|
|
|
class AuthAPIController extends Controller
|
|
{
|
|
protected $member;
|
|
|
|
public function __construct(
|
|
MemberRepositoryInterface $memberRepo
|
|
) {
|
|
$this->member = $memberRepo;
|
|
}
|
|
|
|
public function status(Request $request)
|
|
{
|
|
$result = [];
|
|
$data = json_decode($request->getContent());
|
|
if ($this->member::status()) {
|
|
$result = [
|
|
'message' => 'Authorized',
|
|
'type' => 'apiUseAuthorized',
|
|
'token' => session('token'),
|
|
];
|
|
} else {
|
|
$result = [
|
|
'message' => 'Not Authorized',
|
|
'type' => 'apiUseNotAuthorized',
|
|
];
|
|
}
|
|
|
|
return response()->json($result);
|
|
}
|
|
}
|