Hello everyone. I'm making a form in laravel. one of the features I have is that you can select a customer from a pop-up box and it will put the customer's data in the textbox automatically. This works fine. The problem is when validation fails the old data is not put back in the textbox and you need to select your customer again.
<input type="text" class="form-control" name="customerName" v-model="customerName" value="{{old('customerName')}}">
Above you can see the code of my input. the input is bind to customerName. and because of this the old value cant be retrieved.
note that I'm using this in a normal blade view. and the vue code is stored in app.js.
Thx in advance for helping.
edit
this is the controller with the validation
public function store(Request $request)
{
$data = $this->ValidatedData();
\App\Invoice::create($data);
return redirect('/invoices');
}
protected function ValidatedData()
{
return request()->validate([
'name' => 'required',
'customerName' => 'required',
'customerAdres' => 'required',
'itemsjson' => 'required',
'invoiceNumber' => 'required',
]);
}
and this is the route i use
Route::post('/invoices', 'InvoiceController@store');
What I have tried:
Searched google for a solution. But i could not find anything that helped in my situation.