I keep getting an error that the action is not defined in my controller, but it is. I can access the index action, but not the processOrder action.
Below is my controller and my routes file.
namespace App\Http\Controllers\ThirdPartyAPI;
use App\Order;
use App\ThirdPartyAPI;
use GuzzleHttp\Client;
use App\Jobs\ThirdParyOrders;
use App\ThirdParty\ThirdPartyAPI;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class OrdersController extends Controller
{
public function index ()
{
// list orders
}
public function processOrder()
{
// some logic here
}
}
If my I call the action "@index" in my routes/web.php file, it works and it returns the url, but if I change the "@index" to "@processOrder", it throws the error.
Ie. this works:
Route::get('thirdparty/process-order', function() {
return action('ThirdPartyApi\OrdersController@index');
});
But this doesn't:
Route::get('thirdparty/process-order', function() {
return action('ThirdPartyApi\OrdersController@processOrder');
});
I'm not sure where I'm missing the plot.
I've tried to quit and then re-run:
php artisan serve
I've also tried
composer dump-autoload