I want to get 2 functions by 1 route to view
I tried like this but not working
Route::post('prospect', ['ProspectController@store' ,
'course_controller@show_details']);
I want to get 2 functions by 1 route to view
I tried like this but not working
Route::post('prospect', ['ProspectController@store' ,
'course_controller@show_details']);
Is this what you are looking for ?
Route::get('prospect', 'course_controller@show_details');
Route::post('prospect', 'ProspectController@store');
If you want to show the prospect
after it has been stored, why not just return it in ProspectController@store
?
If you want to follow Restful API design :
Route::post('prospect', 'ProspectController@store'); // return created prospect here
Route::get('prospect/{id}', 'ProspectController@show');
better to used redirect to controller action
try this way
Route::post('prospect', 'ProspectController@store'); //use only one method
now add in line in ProspectController
in store
method if you want to use redirect method
return redirect()->action('HomeController@index');
otherwise use call method only like this way..
app('App\Http\Controllers\course_controller')->show_details();
otherway used like that
app(course_controller::class)->show_details();
or directly create object like that
(new App\Http\Controllers\course_controller())->show_details();
Try this below code:
Route::post('prospect','ProspectController@store');
public function store(Request $request)
{
if($request->something == 'something'):
Self::showDetail();
else:
// Continue store method
endif;
}
public static function showDetail(){
}