Skip to content

Instantly share code, notes, and snippets.

@PavelPolyakov
Last active October 2, 2016 21:06
Show Gist options
  • Save PavelPolyakov/7688524 to your computer and use it in GitHub Desktop.
Save PavelPolyakov/7688524 to your computer and use it in GitHub Desktop.
Complete example of the named routes for the Route::controller, Laravel 4.
<?php
// for Laravel 4.1.*
Route::controller('bank-accounts', 'Dashboard_BankAccountsController', array('getCreate'=>'dashboard.bank-accounts.create',
'postCreate'=>'dashboard.bank-accounts.create.post'));
Route::get('bank-accounts', array('as' => 'dashboard.bank-accounts', 'uses' => 'Dashboard_BankAccountsController@getIndex'));
// for Laravel 4.0.* it was possible to do like this
Route::get('bank-accounts', array('as' => 'dashboard.bank-accounts', 'uses' => 'Dashboard_BankAccountsController@getIndex'));
Route::controller('bank-accounts', 'Dashboard_BankAccountsController', array('getCreate'=>'dashboard.bank-accounts.create',
'postCreate'=>'dashboard.bank-accounts.create.post'));
@montogeek
Copy link

I recommend to use namespaces for routes like: Dashboard\BankAccounts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment