This post is an oldie but a goodie.
@irfanm if you create a corresponding route that gets the Controller@method as you have said, then there is no need of using the action('Controller@method')
Here's a dumb 'gotcha' that I'm sometimes a victim to: Are you certain that the file has the .php extension?
Another one that gets me is a typo in the Controller which can generates a controller not found.
OK, so since I got same error I started fiddling with Laravel inner clockwork to understand the problem. This is what I found out.
When you fire something like:
return redirect()->action('stuff\MainController@welcome');
inside of sample method
MainController@index
you may get error like this one:
InvalidArgumentException in UrlGenerator.php line 610:
Action App\Http\Controllers\stuff\MainController@welcome not defined.
Here is why.
When you use action(), Laravel fires:
\vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator.php@action($action, $parameters = [], $absolute = true)
Above method calls method:
\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php@getByAction($action)
Above method: getByAction($action), to work requires end result of method:
\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php@add(Route $route)
What add(Route $route) method does is (without going deeper into Laravel) it collects Routes listed in file
\app\Http\routes.php
So, logically we need a Route for welcome() method (from my example) defined in routes.php. This will allow Laravel to add welcome() method route to route collection and error disappears.
So by adding
Route::get('/welcome', 'stuff\MainController@welcome');
you can hush that "error" message.
Please or to participate in this conversation.