31 lines
735 B
PHP
31 lines
735 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\Auth\LoginRequest;
|
|
use App\Models\User;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Response;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
class AuthenticatedSessionController extends Controller
|
|
{
|
|
/**
|
|
* Handle an incoming authentication request.
|
|
*/
|
|
public function store(LoginRequest $request): JsonResponse
|
|
{
|
|
$request->authenticate();
|
|
|
|
$authid = uuid_create();
|
|
|
|
Cache::set('BBC-' . $authid, ['User' => $request->user()]);
|
|
|
|
return response()->json(['Success' => true, 'Authorization' => $authid]);
|
|
}
|
|
|
|
}
|