Take a look at http://laravel.com/docs/4.2/controllers#implicit-controllers
app/routes.php:
Route::controller('admin', 'AdminController');
app/controllers/AdminController.php:
class AdminController extends Controller {
public function getIndex()
{
echo 'index'
}
public function getFoo()
{
echo 'foo';
}
}
Then try to navigate to http://project/admin and http://project/admin/foo.
You'd have to define a line in the routes file for each controller, though.
As i understood there is no basic route like in CodeIgniter
FreelancerUz said:
As i understood there is no basic route like in CodeIgniter
What do you mean?
As you can see you wrote
Route::controller('admin', 'AdminController');
In CodeIgniter you don't need to write something to routes.php it just work because CodeIgniter reading URI and trying find the class with that method
Yeah. That's one of CodeIgniter's features, automatic routing. But you'll find in most other frameworks that routing is done manually, as is in Laravel.
I'm coming from a CodeIgniter background myself, and all I can say is that you'll get used to it. Having to manually define your routes (especially with filters and groups) gives you much more flexibility and functionality than CI could ever hope to have.
So no, no automatic routing. Unless you'd implement it yourself with a wildcard route.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community