When i use redirect() method, i can use like
return redirect() -> route('name') -> with('data', 'value')
But, how can i use ‘with’ method on route file?
I want like this:
Route::name('Register')
-> controller(Register::class)
-> prefix('register')
-> group(function() {
Route::name('.Interface')
-> get('/', 'Interface');
Route::name('.Action')
-> post('/', 'Action')
-> middleware([HandlePrecognitiveRequests::class])
-> with('register.section', function() {
if(Session::get('register.section') == 1) return 2;
return 1;
});
Route::name('.EmailVerificationInterface')
-> get('email-verification', 'EmailVerificationInterface');
Route::name('.EmailVerificationProcess')
-> post('email-verification', 'EmailVerificationProcess');
});
How can i use ‘with’ method in route file?
New contributor
Zain Hibattulloh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.