6.7.5. Changing the Routes

Now that all controllers are written, we are going to change the routes so that our website opens the list of invoices on the start page. Be aware that routes are configured in the file app/Http/routes.php in Laravel 5.2 and in routes/wep.php in Laravel 5.3.

  1. Route::get('/', 'InvoiceController@showInvoices');
  2. Route::get('/customers', 'CustomerController@showCustomers');
  3. Route::any('/customer/edit', 'CustomerController@editCustomer');
  4. Route::get('/products', 'ProductController@showProducts');
  5. Route::any('/product/edit', 'ProductController@editProduct');
  6. Route::get('/invoices', 'InvoiceController@showInvoices');
  7. Route::any('/invoice/edit', 'InvoiceController@editInvoice');
  8. Route::any('/invoice/pay/{id}', 'InvoiceController@payInvoice');
  9. Route::any('/invoice/editline', 'InvoiceController@editInvoiceLine');

Here the /invoice/pay/{id} route picks up the invoice identifier from the URL and sends it to the payInvoice method. The rest of the routes should be self-explanatory.