jonnybarnes.uk/app/Http/Middleware/LocalhostSessionMiddleware.php
Jonny Barnes 39a197ae7b
refactor: Refactor file headers and add Psalm suppressions
- Added Psalm suppression annotations to multiple controller classes
- Added PHPDoc comment blocks to seeders and factories
- Added comments to indicate unused classes and methods
- Removed unused annotations and imports
2023-07-28 11:48:07 +01:00

28 lines
646 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types=1);
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class LocalhostSessionMiddleware
{
/**
* Whilst we are developing locally, automatically log in as
* `['me' => config('app.url')]` as I cant manually log in as
* a .localhost domain.
*
* @psalm-suppress PossiblyUnusedMethod
*/
public function handle(Request $request, Closure $next): Response
{
if (config('app.env') !== 'production') {
session(['me' => config('app.url')]);
}
return $next($request);
}
}