I'm using the replicate eloquent and it doesn't work on me. Replicate the row in database with changing some columns and it will save by clicking the button, can you please help me? My coding for controller
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");
Coding for my 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>
And this is my route
Route::get('/viewpayrolls/{id}','PayrollController@newpayrolls');