通过更改某些列在Laravel中复制口才

时间:2019-01-31 02:53:48

标签: javascript php laravel replicate

我使用的是雄辩的复制,对我不起作用。通过更改某些列来复制数据库中的行,单击该按钮将保存该行,请您帮帮我吗? 我对控制器的编码

   public function newpayrolls(Request $request, $id){
    $newpay = Payroll::find($id);
    $newpay = $newpay->replicate();
    $newpay->id = $new_id;
    $newpay->data = $new_data;
    $newpay->save();
     return redirect("/payroll");

为我的blade.php编码

 <button class ="btn btn-primary btnd" type="submit" value="Submit">
      <span class="glyphicon glyphicon-arrow-left small"></span> Save as 
 new Payroll
    </button>
    </div>

这是我的路线

Route::get('/viewpayrolls/{id}','PayrollController@newpayrolls');

0 个答案:

没有答案