bootstrap-form icon indicating copy to clipboard operation
bootstrap-form copied to clipboard

Adding default routes to BootstrapForm::open

Open csrui opened this issue 9 years ago • 1 comments

Hi,

Laravel neewb here with a suggestion.

As I can understand this currently only works with named routes or am I wrong?

Can the open method be made simpler by assuming some defaults? Instead of manually specifing the store and update routes, can't the current route controller be auto detected and by default assume the current_controller.store and current_controller.update?

This would cleanup and allow a simpler call like so:

BootstrapForm::open(array('model' => $user));

Instead of a more verbouse aproach like the current:

BootstrapForm::open(array('model' => $user, 'store' => 'users.store', 'update' => 'users.update'));

csrui avatar Feb 24 '15 18:02 csrui

Yeah, named routes are limitation of the current version, but something I'd like to fix in an upcoming release (add actions and URLs as well).

It's an interesting idea, it will become very difficult once we start looking at nested resources or namespaced controllers. For example, my Admin\UsersController has a route name of admin.users.store but not sure how others might approach that problem.

dwightwatson avatar Feb 25 '15 04:02 dwightwatson