Middleware not working

I'm having an issue with some middlewear I'm trying to add into my system, but it looks like the middelwear is not even being used. I created a EnsureTrialNotExpired middlewear, and inside that middlewear I've just added a DD or a log to see any output and its not showing anything. Just navigates to the panel as intended if the middlewear wasn't there. Company Panel
>middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
EnsureTrialNotExpired::class,
], isPersistent: true)
>middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
EnsureTrialNotExpired::class,
], isPersistent: true)
Middlewear
<?php

namespace App\Http\Middleware;

use Closure;
use Filament\Facades\Filament;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;

class EnsureTrialNotExpired
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
dd('we hit this');
return $next($request);
}
}
<?php

namespace App\Http\Middleware;

use Closure;
use Filament\Facades\Filament;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;

class EnsureTrialNotExpired
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
dd('we hit this');
return $next($request);
}
}
Not sure if I'm missing something here, also would this work to do a check for auth()->user(). I have also tried adding it into
->tenantMiddleware([
//
], isPersistent: true)
->tenantMiddleware([
//
], isPersistent: true)
But also still no luck Any help would be great as I'm ripping my hair out 🤣
Solution:
php artisan optimize:clear ?
Jump to solution
3 Replies
Solution
toeknee
toeknee4w ago
php artisan optimize:clear ?
Wazza
WazzaOP4w ago
Well that worked :Facepalm: thank you ❤️
toeknee
toeknee4w ago
Welcomes!

Did you find this page helpful?