init
This commit is contained in:
5
app/Http/Controllers/Controller.php
Normal file
5
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller {}
|
||||
21
app/Http/Middleware/CreateClientTokenMiddlewire.php
Normal file
21
app/Http/Middleware/CreateClientTokenMiddlewire.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class CreateClientTokenMiddlewire
|
||||
{
|
||||
public function handle(Request $request, \Closure $next): Response
|
||||
{
|
||||
$token = $this->createGuestToken($request);
|
||||
$request->merge(['clientToken' => $token]);
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
public function createGuestToken(Request $request)
|
||||
{
|
||||
return sha1($request->ip() . $request->header('User-Agent'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user