As in CI4 redirect works like return redirect()->route(). I want to know How I can use a variable in redirect.
When I'm using simple route in redirect. It works.
Like
Route: $routes->get('about-us', 'Main::about_us');
return redirect('about-us')
Its work fine.
But when I use parameter in redirect it shows an error. i.e (route cannot be found while reverse-routing.)
$studentid is some string.
return redirect('
Student/ViewStudentProfile/'.$studentid');
I have also tried with route but not working.
return redirect()->route('Student/ViewStudentProfile/'.$studentid) ;
My route is
$routes->get('
Student/ViewStudentProfile/(:any)' , 'backend/Student_Controller::ViewStudentProfile');
I have spend a lot of time but not found any solution.
Any help would be greatly appreciated.