php - Laravel - extending a ResourceController -


i have 2 different forms should use 1 controller. created controller resource controller using following method in routes.php:

route::resource('account', 'accountcontroller'); 

in first form use

{{ form::model($user, array('route' => array('account.update', $user->id), 'method' => 'put', 'class' => 'form-outside', 'files' => true)) }} 

as resource controller knows update function works well.

however want create second form, relates account , updates other sections of user's profile. want extend controller function "updatesettings."

but how can that? created function in accountcontroller , use following in second form:

{{ form::model($user, array('action' => array('accountcontroller@updatesettings', $user->id), 'method' => 'put', 'class' => 'form-outside')) }} 

but laravel fires exception

route [accountcontroller@updatesettings] not defined.

how can extend resource controller updatesettings valid method? or how can use model binding forms without resource controller?

thanks!

to extend resource controller need extend class illuminate\routing\router , override needed methods. next step use app::bind() substitute old router class new 1 write.

faster method use new route, giving unique name, ex in routes.php: app::put('updatesettings', 'accountcontroller@updatesettings'). luck.


Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -