I have been using Laravel for a couple years and I'm stumped on this one. Using Laravel 5.4 with voyager. I have my own controller outside of the BREAD controller
Form:
<form method="POST" action="/admin/invites" accept-charset="UTF-8" class="form-edit-add">
<input name="_token" type="hidden" value="QgLgj5tG4RfD2CxCsqE2Qn5jcWfwQhsk5THT30vO">
<div class="panel-body">
<div class="form-group">
<label for="name">Business</label>
<input class="form-control" placeholder="Business Name" name="business_id" type="text">
</div>
<div class="form-group">
<label for="body">Referral Name</label>
<input class="form-control" placeholder="Referral Name" name="referral_name" type="text">
</div>
</div>
<input class="btn btn-primary width-100 mb-xs" type="submit" value="Save">
</form>
web routes:
Route::resource('/admin/invites', 'InviteController');
Controller:
public function store(Requests\InviteRequest $request)
{
DB::table('invites')->insert(
[
'user_id' => Auth::user()->id,
'business_id' => $request->business_id,
'referral_name' => $request->referral_name,
'url_token' => str_random(16)
]
);
return redirect('/admin/invites')->with([
'message' => "Successfully Added New",
'alert-type' => 'success',
]);
}
When I submit it creates 2 rows in the database. I don't have duplicate routes or controllers. My Request file is empty. I have an ID in the table that is auto increment with primary index.
Any thoughts or troubleshooting tips?