douwa0280
2016-01-11 22:21
浏览 49
已采纳

laravel 5.1表单和路由问题

Hi i am trying to get the output from my form to save and even when i try to echo(print_r) the output it but it simply goes to the post request and does not echo any output.

my route looks like:

Route::controller('stove', 'StoveController', [
    'anyData'  => 'stove.data',
    'getIndex' => 'stove',
]);

Route::get('newstove', 'StoveController@addData');
Route::post('newstove', 'StoveController@store');

my controller:

public function addData()
{

    return view('stoves.new');
}

public function store()
{
    $input = Request::all();
    Stove::create($input);

    return redirect('stove');
}

and finally my form is

<form class="form-horizontal" action="/stove">
    <fieldset>
        <div class="control-group">
            <label class="control-label" for="stoveno">Stove Number</label>
            <div class="controls">
                <input type="text" class="span4" id="stoveno" value="CP001000">
            </div> <!-- /controls -->
        </div> <!-- /control-group -->

        <div class="control-group">
            <label class="control-label" for="refno">Ref Number</label>
            <div class="controls">
                <input type="text" class="span4" id="refno" value="cff001">
            </div> <!-- /controls -->
        </div> <!-- /control-group -->

        <div class="control-group">
            <label class="control-label" for="manufacturedate">Manufacture Date</label>
            <div class="controls">
                <input type="date" class="span4" id="manufacturedate">
            </div> <!-- /controls -->
        </div> <!-- /control-group-->

        <div class="form-actions">
            <button type="submit" class="btn btn-primary">Save</button>
            <button class="btn">Cancel</button>
        </div> <!-- /form-actions -->
    </fieldset>
</form>

Thanks

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题