If I understand what you want, maybe you have wanna check laravel 5 route annotation feature: https://laracasts.com/discuss/channels/general-discussion/route-annotation-in-laravel-5
In Laravel/4 you can use something like
// Admin routes
Route::group(array('prefix' => 'admin', 'before' => 'auth'), function()
{
// Example route with an admin prefix
Route::get('/', array('uses' => 'AdminIndexController@index', 'as' => 'admin.dashboard'));
});
Where you need to be authenticated to access any admin route and then your controllers exist in
/app/controllers/admin
and views in
/app/views/admin
models stay the same
Hope that helps.
I think he wanna create the routes automatically...
Code can't write itself :-) but he can use restful routing and wildcards inside the admin prefix. Best I can think of.
I know code can't write itself (fortunately) but, I mean, as far I understand from mehranhadidi question, he wanna create routes automatically from existing controllers... and the better solution I know is route annotation :)
Or resources routing as you wrote before ;)
I thought that was new in #5? I'm very new to laravel, just learned the basics of #4 and already moved to #5 (doh)
@mehranhadidi - Maybe #5 is your way forward?
@jacksoncharles yes, route annotation is new in version 5, but isn't mandatory :)
Well, I think the definitive answer to his #4 question using his example controllers would read
// Admin routes
Route::group(array('prefix' => 'admin', 'before' => 'auth'), function()
{
// Restful routes
Route::resource('users','AdminUsersController');
Route::resource('products','AdminProductsController');
});
Which would give him all the basic routes he needs for the two controllers he mentions. Correct me if I am wrong.
5 is a different conversation.
yes, my mistake was to speak about version 5 :) but he was speaking about a new large project to start so, maybe he can start it with version 5 ;)
hi everybody, i am very proud of u guys to answer my question as quick as you could <3
first of all i saw that some of you talked about laravel version 5? i didn't saw it on laravel official site? where can i download it? where its docs? and is it final version or not? because i want to use it for a large scale project.
after that i want to make a routing like any other frameworks like kohana, zend, cakephp, & ....
i have seen so many open source project these days of laravel. & i saw that most of them defined their routs manualy. i can't do this because :
i want to create a CMS with laravel. my client's cms has about 70 modules. & each modules has so many actions: (example: basic CRUD)
70*4(minimum actions) = 280 routes i should define on routes.php?????? :(
my project should be something modular & should handle somethings automatically . i should made it with a base of large scale structure. thanks for ur attention <3
mehranhadidi said:
hi everybody, i am very proud of u guys to answer my question as quick as you could <3
first of all i saw that some of you talked about laravel version 5? i didn't saw it on laravel official site? where can i download it? where its docs? and is it final version or not? because i want to use it for a large scale project.
http://laravel.com/docs/master Laravel 5 is currently in development, but it's going to be stable soon. If I am not wrong it should be in this year. On laracasts you can find a serie about the new features of laravel 5 and how to start. You should check it out, I really recommend that.
after that i want to make a routing like any other frameworks like kohana, zend, cakephp, & ....
i have seen so many open source project these days of laravel. & i saw that most of them defined their routs manualy. i can't do this because :
i want to create a CMS with laravel. my client's cms has about 70 modules. & each modules has so many actions: (example: basic CRUD)
70*4(minimum actions) = 280 routes i should define on routes.php?????? :(
This is just the usual way. You can use resource routes and controllers. So you have only one route for actually 5 actions (index, create, edit, update, delete). Take a look at:http://laravel.com/docs/4.2/controllers#restful-resource-controllers
Anyway, I think defining your routes is going to be the least of your problems. There are bigger issues which you have to tackle while developing.
@mehraiadidi I think you can have some help reading here ;) http://stackoverflow.com/questions/13297278/laravel-using-any-wildcard-for-all-routes
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community