laravel: using parameters from routes in blade forms -


this add.blade.php.

{{ form::open(array('url' => $id."/item", 'method' => 'post', 'files' => 'true', 'id'=>'add')) }}     {{ form::text('title'}}     {{form::submit('submit')}} {{form::close()}} 

this web.php

route::resource('{categoryid}/item', 'itemcontroller'); 

this itemcontroller.php

public function create($categoryid){       return view('item.add', array('id' => $categoryid)); } 

i trying add new item category. click add new , opens add.blade.php. when submit add.blade.php, redirecting item/create. think because of url in form of add.blade.php. correct way of doing this? in advance

you can try prefix instead of append parameter

route::group(['prefix' => '{categoryid}'], function()     route::resource('item', 'itemcontroller'); }); 

then use

route('item.create',['1']); 

here in code pass parameter , work this:

['route' => ['item.create', $id]


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -