What, in my opinion, would be a cleaner solution is to send your mail request to different URLs depending on your flag and have different routes for each that map to your controller methods.
Route::post('/flag', ' MyController@methodA '); Route::post('/', ' MyController@methodB );
EDIT:
To do it your own way you can use this snippet
Route:post('/', function(){ $app = app(); $controller = $app->make('MyController'); $flag = Input::get('flag'); if($flag == 1) { return $controller->callAction('methodA', $parameters = array()); } else { return $controller->callAction('methodB', $parameters = array()); } });
A source
OR
Route:post('/', function(){ $flag = Input::get('flag'); if($flag == 1) { App::make('MyController')->methodA(); } else { App::make('MyController')->methodB(); } });
A source
And just to mention - I have absolutely zero practical experience with Laravel, I just searched and found this.
source share