Missing required parameters for [Route: verification.notice] [URI: {language}/email/verify]
I added the laravel email verification to my project, after using localization. But now I have the problem that the Route: verification.notice is missing a parameter. I know that I need to add/pass the app()->getLocale() parameter to the route but can't find where
I tried searching all the routes and the URLs in the project and also checked the VerificationController.php and the verify.blade.php. But I didn't find the route with the missing parameter. Also, I couldn't find someone else online with the same problem.
web.php
Route::group([
'prefix' => '{language}',
'where' => ['{language}' => '[a-Za-Z]{2}'],
'middleware' => 'SetLanguage',
],
function () {
Route::get('/', function () {
return view('welcome');
})->name('Welcome');
Auth::routes(['verify' => true]);
Route::get('/home', 'HomeController@index')->name('home');
Route::namespace('User')->group(function () {
Route::get('/profile', 'UserController@editProfile')->name('profile');
Route::put('profile', 'UserController@updateProfile');
});
Route::namespace('Admin')->group(function () {
Route::get('/dashboard', 'AdminController@index')->name('dashboard');
});
});
UserController
class UserController extends Controller
{
public function __construct()
{
$this->middleware('verified');
}
public function editProfile()
{
$user = User::where('id', Auth()->user()->id)->first();
return view('user.profile', compact('user'));
}
}
----edit----
SetLanguage.php
namespace App\Http\Middleware;
use App;
use Closure;
class SetLanguage
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
App::setLocale($request->language);
return $next($request);
}
}
SetLanguage
middleware code. – Hardset