-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] CrudRoute Abstraction for extensibility #230
Conversation
abstracted the crud router away from the service provider, so it can be extended and chained, more laravelly!
[ci skip] [skip ci]
This. Looks. AWESOME! |
Just tried it out, it looks and works great. Awesome work.
CRUD::resource(‘teams’, ‘Admin\TeamCrudController’)->with(function(){
// I can be used to run call backs, or add extra routes to this resource
Route::get('teams/ajax-name-options', 'Admin\TeamCrudController@nameOptions');
Route::get('teams/ajax-category-options', 'Admin\TeamCrudController@categoryOptions');
}); But I tried it and it didn't work, I got 403 error. I don't get it. Checkout out the methods again. It should work. Checked out Any idea? Does it work for you? Again, really awesome work man, this is such a good PR :-) |
Ok, I fixed it by placing the Sorry for the verbosity. Only need you to confirm you're ok with the method names or propose better ones. Cheers! |
Oh thats very odd! I'd literally been using it and hadn't experienced that! super weird! But yeah it means we could have withFilters, withSearch etc etc as optional, rather than adding all the extra ones by default One thing I wanted it to do was act like a CRUD::resource(‘teams’, ‘Admin\TeamCrudController’)->with(function(){
// I can be used to run call backs, or add extra routes to this resource
Route::get('ajax-name-options', 'Admin\TeamCrudController@nameOptions');
Route::get('ajax-category-options', 'Admin\TeamCrudController@categoryOptions');
}); it would prefix the route with But wouldn't figure out anyway to do that without creating custom CRUD::get etc. Regards to the renaming yes thats fine! they were legacy names actually, previously I had it setup differently and just renamed it all for the PR and missed them! so good spot! I also really like the idea of the |
Uuuu... |
Instead of having a static CRUD::resource within the service provider I’ve abstracted it out into CrudRouter.
This then returns from the original resource allowing people to add extra closures, and will permit us to add extra routes to resources.
e.g
The first example is what I imagine to be the most used method, it will allow us to have lighter weight routes, then extend them when desired. This would allow us to implement things like the unicity checks etc.
As its backwards compatible, would be nice to get this in asap :P especially as we're using it currently :D