I have a working solution within routes.php, but I understand that laravel can handle restful routes better. I've tried using their documentation to implement restful resource controllers, but had no luck.
This is what I have at the moment
Route::get('/invoices', 'InvoicesController@showInvoices');
Route::get('/invoices/data', 'InvoicesController@getInvoices');
Basically, the showInvoices returns the invoices view and getInvoices returns a JSON string for DataTables which is called from the invoices view.
So I want to be able to call /invoices to get the view and then call /invoices/data using JavaScript.
Any suggestions how to convert this to a resource controller or more suitable controller?
view
before returning – jonjuRoute::get('invoices/data', 'InvoiceController@method');
before defining resource controller in your route file. – Adam Mańkowskiget()
requests – scottevans93