'web' => [
    \App\Http\Middleware\EncryptCookies::class,
    ...
    \DMSysOp\SweetAlert\Core\SweetAlert::class,
]

Below is a method to use alert popup using middleware.

return redirect('home')->with(['title' => 'Successfully login','type' => 'success'])