Custom Error Messages after submitting data Laravel












0















I already asked this question but there are a few things different this time. Last time the problem was fixed pretty well so now i just need a hand to tell me how to change the code so it works properly.



The thing i have changed is that i have implemented a way to successfully lend more then one book at once. So now i have an array which works perfectly.



So this is my View imagine this code 3 times one for every book you want to lend:



<div class="form-group row">
<label for="serialnumber" class="col-md-4 col-form-label text-md-right">{{ __('Gerät 1 (serialnumber) :') }}</label>
<div class="col-md-6">
<input id="serialnumber" type="text" class="form-control{{ $errors->has('serialnumber') ? ' is-invalid' : '' }}" name="serialnumber" value="{{ old('serialnumber') }}" required @if (Session::has('autofocus')) autofocus @endif>
@if ($errors->any())
<div class="alert alert-danger">The book with this serialnumber is already lend by antoher person
<ul>

</ul>
</div>
@endif
</div>
</div>


This is my Controller Code now:



public function store(BookRequest $request)
{

//if( !Book::find($request->get('serialnumber'))->exists() ) {
$this->middleware('guest');

request()->validate([
'serialnumber' => 'required',
'ma_id' => 'required'
]);

$requestData = $request->all();

$data = [
[
'serialnumber' => $requestData['serialnumber'][0],
'comment' => $requestData['comment'],
'ma_id' => $requestData['ma_id'],


],
[
'serialnumber' => $requestData['serialnumber'][1],
'comment' => $requestData['comment'],
'ma_id' => $requestData['ma_id'],

],

[
'serialnumber' => $requestData['serialnumber'][2],
'comment' => $requestData['comment'],
'ma_id' => $requestData['ma_id'],

]
];

Book::insert($data);

return redirect()->route('borrow.index')
->with('success','Successfully lend the book');

}


And the last is my Request.php page:



<?php

namespace AppHttpRequests;

use IlluminateFoundationHttpFormRequest;

class BookRequest extends FormRequest
{
public function authorize()
{
return true;
}

public function rules()
{
return [
'serialnumber[0]' => 'required|unique:borrowed,serialnumber,null',
'serialnumber[1]' => 'required|unique:borrowed,serialnumber,null',
'serialnumber[2]' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}

public function messages()
{
return [
'serialnumber' => 'Seems like you have added the same book more than once!',
];
}
}


And this is my error message which i got after i tried to lend a book which is already lend by another person. Before i implemented the array thing this code worked perfect. Another question that i have is how could i implement a way which shows an error message which says "Sorry but this book is currently not in our database please press the info button and get some administraive help" so that basically an error message appears when the book is not in our database we have a lot of books so it is possible that we forget to scan one. Every help is much appreciated!!



EDIT:
Forgot the error message




htmlspecialchars() expects parameter 1 to be string, array given











share|improve this question

























  • Are the three serialnumbers fix?

    – common sense
    Nov 19 '18 at 10:58











  • what did you mean by that?

    – Devi
    Nov 19 '18 at 11:41











  • Do you have all the time just 3 serialnumbers or can the amount raise. If so, you have to adjust the rules and Controller everytime.

    – common sense
    Nov 19 '18 at 11:56











  • You can type in up to 3 serialnumbers but not more then 3

    – Devi
    Nov 19 '18 at 11:59
















0















I already asked this question but there are a few things different this time. Last time the problem was fixed pretty well so now i just need a hand to tell me how to change the code so it works properly.



The thing i have changed is that i have implemented a way to successfully lend more then one book at once. So now i have an array which works perfectly.



So this is my View imagine this code 3 times one for every book you want to lend:



<div class="form-group row">
<label for="serialnumber" class="col-md-4 col-form-label text-md-right">{{ __('Gerät 1 (serialnumber) :') }}</label>
<div class="col-md-6">
<input id="serialnumber" type="text" class="form-control{{ $errors->has('serialnumber') ? ' is-invalid' : '' }}" name="serialnumber" value="{{ old('serialnumber') }}" required @if (Session::has('autofocus')) autofocus @endif>
@if ($errors->any())
<div class="alert alert-danger">The book with this serialnumber is already lend by antoher person
<ul>

</ul>
</div>
@endif
</div>
</div>


This is my Controller Code now:



public function store(BookRequest $request)
{

//if( !Book::find($request->get('serialnumber'))->exists() ) {
$this->middleware('guest');

request()->validate([
'serialnumber' => 'required',
'ma_id' => 'required'
]);

$requestData = $request->all();

$data = [
[
'serialnumber' => $requestData['serialnumber'][0],
'comment' => $requestData['comment'],
'ma_id' => $requestData['ma_id'],


],
[
'serialnumber' => $requestData['serialnumber'][1],
'comment' => $requestData['comment'],
'ma_id' => $requestData['ma_id'],

],

[
'serialnumber' => $requestData['serialnumber'][2],
'comment' => $requestData['comment'],
'ma_id' => $requestData['ma_id'],

]
];

Book::insert($data);

return redirect()->route('borrow.index')
->with('success','Successfully lend the book');

}


And the last is my Request.php page:



<?php

namespace AppHttpRequests;

use IlluminateFoundationHttpFormRequest;

class BookRequest extends FormRequest
{
public function authorize()
{
return true;
}

public function rules()
{
return [
'serialnumber[0]' => 'required|unique:borrowed,serialnumber,null',
'serialnumber[1]' => 'required|unique:borrowed,serialnumber,null',
'serialnumber[2]' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}

public function messages()
{
return [
'serialnumber' => 'Seems like you have added the same book more than once!',
];
}
}


And this is my error message which i got after i tried to lend a book which is already lend by another person. Before i implemented the array thing this code worked perfect. Another question that i have is how could i implement a way which shows an error message which says "Sorry but this book is currently not in our database please press the info button and get some administraive help" so that basically an error message appears when the book is not in our database we have a lot of books so it is possible that we forget to scan one. Every help is much appreciated!!



EDIT:
Forgot the error message




htmlspecialchars() expects parameter 1 to be string, array given











share|improve this question

























  • Are the three serialnumbers fix?

    – common sense
    Nov 19 '18 at 10:58











  • what did you mean by that?

    – Devi
    Nov 19 '18 at 11:41











  • Do you have all the time just 3 serialnumbers or can the amount raise. If so, you have to adjust the rules and Controller everytime.

    – common sense
    Nov 19 '18 at 11:56











  • You can type in up to 3 serialnumbers but not more then 3

    – Devi
    Nov 19 '18 at 11:59














0












0








0








I already asked this question but there are a few things different this time. Last time the problem was fixed pretty well so now i just need a hand to tell me how to change the code so it works properly.



The thing i have changed is that i have implemented a way to successfully lend more then one book at once. So now i have an array which works perfectly.



So this is my View imagine this code 3 times one for every book you want to lend:



<div class="form-group row">
<label for="serialnumber" class="col-md-4 col-form-label text-md-right">{{ __('Gerät 1 (serialnumber) :') }}</label>
<div class="col-md-6">
<input id="serialnumber" type="text" class="form-control{{ $errors->has('serialnumber') ? ' is-invalid' : '' }}" name="serialnumber" value="{{ old('serialnumber') }}" required @if (Session::has('autofocus')) autofocus @endif>
@if ($errors->any())
<div class="alert alert-danger">The book with this serialnumber is already lend by antoher person
<ul>

</ul>
</div>
@endif
</div>
</div>


This is my Controller Code now:



public function store(BookRequest $request)
{

//if( !Book::find($request->get('serialnumber'))->exists() ) {
$this->middleware('guest');

request()->validate([
'serialnumber' => 'required',
'ma_id' => 'required'
]);

$requestData = $request->all();

$data = [
[
'serialnumber' => $requestData['serialnumber'][0],
'comment' => $requestData['comment'],
'ma_id' => $requestData['ma_id'],


],
[
'serialnumber' => $requestData['serialnumber'][1],
'comment' => $requestData['comment'],
'ma_id' => $requestData['ma_id'],

],

[
'serialnumber' => $requestData['serialnumber'][2],
'comment' => $requestData['comment'],
'ma_id' => $requestData['ma_id'],

]
];

Book::insert($data);

return redirect()->route('borrow.index')
->with('success','Successfully lend the book');

}


And the last is my Request.php page:



<?php

namespace AppHttpRequests;

use IlluminateFoundationHttpFormRequest;

class BookRequest extends FormRequest
{
public function authorize()
{
return true;
}

public function rules()
{
return [
'serialnumber[0]' => 'required|unique:borrowed,serialnumber,null',
'serialnumber[1]' => 'required|unique:borrowed,serialnumber,null',
'serialnumber[2]' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}

public function messages()
{
return [
'serialnumber' => 'Seems like you have added the same book more than once!',
];
}
}


And this is my error message which i got after i tried to lend a book which is already lend by another person. Before i implemented the array thing this code worked perfect. Another question that i have is how could i implement a way which shows an error message which says "Sorry but this book is currently not in our database please press the info button and get some administraive help" so that basically an error message appears when the book is not in our database we have a lot of books so it is possible that we forget to scan one. Every help is much appreciated!!



EDIT:
Forgot the error message




htmlspecialchars() expects parameter 1 to be string, array given











share|improve this question
















I already asked this question but there are a few things different this time. Last time the problem was fixed pretty well so now i just need a hand to tell me how to change the code so it works properly.



The thing i have changed is that i have implemented a way to successfully lend more then one book at once. So now i have an array which works perfectly.



So this is my View imagine this code 3 times one for every book you want to lend:



<div class="form-group row">
<label for="serialnumber" class="col-md-4 col-form-label text-md-right">{{ __('Gerät 1 (serialnumber) :') }}</label>
<div class="col-md-6">
<input id="serialnumber" type="text" class="form-control{{ $errors->has('serialnumber') ? ' is-invalid' : '' }}" name="serialnumber" value="{{ old('serialnumber') }}" required @if (Session::has('autofocus')) autofocus @endif>
@if ($errors->any())
<div class="alert alert-danger">The book with this serialnumber is already lend by antoher person
<ul>

</ul>
</div>
@endif
</div>
</div>


This is my Controller Code now:



public function store(BookRequest $request)
{

//if( !Book::find($request->get('serialnumber'))->exists() ) {
$this->middleware('guest');

request()->validate([
'serialnumber' => 'required',
'ma_id' => 'required'
]);

$requestData = $request->all();

$data = [
[
'serialnumber' => $requestData['serialnumber'][0],
'comment' => $requestData['comment'],
'ma_id' => $requestData['ma_id'],


],
[
'serialnumber' => $requestData['serialnumber'][1],
'comment' => $requestData['comment'],
'ma_id' => $requestData['ma_id'],

],

[
'serialnumber' => $requestData['serialnumber'][2],
'comment' => $requestData['comment'],
'ma_id' => $requestData['ma_id'],

]
];

Book::insert($data);

return redirect()->route('borrow.index')
->with('success','Successfully lend the book');

}


And the last is my Request.php page:



<?php

namespace AppHttpRequests;

use IlluminateFoundationHttpFormRequest;

class BookRequest extends FormRequest
{
public function authorize()
{
return true;
}

public function rules()
{
return [
'serialnumber[0]' => 'required|unique:borrowed,serialnumber,null',
'serialnumber[1]' => 'required|unique:borrowed,serialnumber,null',
'serialnumber[2]' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}

public function messages()
{
return [
'serialnumber' => 'Seems like you have added the same book more than once!',
];
}
}


And this is my error message which i got after i tried to lend a book which is already lend by another person. Before i implemented the array thing this code worked perfect. Another question that i have is how could i implement a way which shows an error message which says "Sorry but this book is currently not in our database please press the info button and get some administraive help" so that basically an error message appears when the book is not in our database we have a lot of books so it is possible that we forget to scan one. Every help is much appreciated!!



EDIT:
Forgot the error message




htmlspecialchars() expects parameter 1 to be string, array given








php html laravel laravel-5






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 11:48







Devi

















asked Nov 19 '18 at 10:41









DeviDevi

398




398













  • Are the three serialnumbers fix?

    – common sense
    Nov 19 '18 at 10:58











  • what did you mean by that?

    – Devi
    Nov 19 '18 at 11:41











  • Do you have all the time just 3 serialnumbers or can the amount raise. If so, you have to adjust the rules and Controller everytime.

    – common sense
    Nov 19 '18 at 11:56











  • You can type in up to 3 serialnumbers but not more then 3

    – Devi
    Nov 19 '18 at 11:59



















  • Are the three serialnumbers fix?

    – common sense
    Nov 19 '18 at 10:58











  • what did you mean by that?

    – Devi
    Nov 19 '18 at 11:41











  • Do you have all the time just 3 serialnumbers or can the amount raise. If so, you have to adjust the rules and Controller everytime.

    – common sense
    Nov 19 '18 at 11:56











  • You can type in up to 3 serialnumbers but not more then 3

    – Devi
    Nov 19 '18 at 11:59

















Are the three serialnumbers fix?

– common sense
Nov 19 '18 at 10:58





Are the three serialnumbers fix?

– common sense
Nov 19 '18 at 10:58













what did you mean by that?

– Devi
Nov 19 '18 at 11:41





what did you mean by that?

– Devi
Nov 19 '18 at 11:41













Do you have all the time just 3 serialnumbers or can the amount raise. If so, you have to adjust the rules and Controller everytime.

– common sense
Nov 19 '18 at 11:56





Do you have all the time just 3 serialnumbers or can the amount raise. If so, you have to adjust the rules and Controller everytime.

– common sense
Nov 19 '18 at 11:56













You can type in up to 3 serialnumbers but not more then 3

– Devi
Nov 19 '18 at 11:59





You can type in up to 3 serialnumbers but not more then 3

– Devi
Nov 19 '18 at 11:59












1 Answer
1






active

oldest

votes


















1














Change your view:



@if(!empty(old('serialnumber')))
@foreach(old('serialnumber') as $i=>$value)
<input id="serialnumber" type="text" class="form-control{{ $errors->has('serialnumber') ? ' is-invalid' : '' }}" name="serialnumber" value="{{ old('serialnumber.'.$i) }}" required @if (Session::has('autofocus')) autofocus @endif>

@endforeach
@endif


where $i is your array index



aslo you can modify your rules and message like:



 public function rules(){
return [
'serialnumber.0' => 'required|unique:borrowed,serialnumber,null',
'serialnumber.1' => 'required|unique:borrowed,serialnumber,null',
'serialnumber.2' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}


or



public function rules(){
return [
'serialnumber.*' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}


and



public function messages()
{
return [
'serialnumber.*' => 'Seems like you have added the same book more than once!',
];
}





share|improve this answer


























  • Where do i implement the "$i" cause it says its undefined and i dont know where to define it :o And thanks for the detailed answer!

    – Devi
    Nov 19 '18 at 12:30











  • @Devi check old value in your blade file like @foreach(old('serialnumber') as $i=>$value)

    – Tarun Saini
    Nov 19 '18 at 12:36











  • Is there anywhere an quotation marks mistake? In the Input field

    – Devi
    Nov 19 '18 at 12:50











  • And my input field disappears when i implement the if and the foreach..

    – Devi
    Nov 19 '18 at 13:11











  • this is only for old values when you got errors otherwise use simple html input

    – Tarun Saini
    Nov 19 '18 at 13:17











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372854%2fcustom-error-messages-after-submitting-data-laravel%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Change your view:



@if(!empty(old('serialnumber')))
@foreach(old('serialnumber') as $i=>$value)
<input id="serialnumber" type="text" class="form-control{{ $errors->has('serialnumber') ? ' is-invalid' : '' }}" name="serialnumber" value="{{ old('serialnumber.'.$i) }}" required @if (Session::has('autofocus')) autofocus @endif>

@endforeach
@endif


where $i is your array index



aslo you can modify your rules and message like:



 public function rules(){
return [
'serialnumber.0' => 'required|unique:borrowed,serialnumber,null',
'serialnumber.1' => 'required|unique:borrowed,serialnumber,null',
'serialnumber.2' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}


or



public function rules(){
return [
'serialnumber.*' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}


and



public function messages()
{
return [
'serialnumber.*' => 'Seems like you have added the same book more than once!',
];
}





share|improve this answer


























  • Where do i implement the "$i" cause it says its undefined and i dont know where to define it :o And thanks for the detailed answer!

    – Devi
    Nov 19 '18 at 12:30











  • @Devi check old value in your blade file like @foreach(old('serialnumber') as $i=>$value)

    – Tarun Saini
    Nov 19 '18 at 12:36











  • Is there anywhere an quotation marks mistake? In the Input field

    – Devi
    Nov 19 '18 at 12:50











  • And my input field disappears when i implement the if and the foreach..

    – Devi
    Nov 19 '18 at 13:11











  • this is only for old values when you got errors otherwise use simple html input

    – Tarun Saini
    Nov 19 '18 at 13:17
















1














Change your view:



@if(!empty(old('serialnumber')))
@foreach(old('serialnumber') as $i=>$value)
<input id="serialnumber" type="text" class="form-control{{ $errors->has('serialnumber') ? ' is-invalid' : '' }}" name="serialnumber" value="{{ old('serialnumber.'.$i) }}" required @if (Session::has('autofocus')) autofocus @endif>

@endforeach
@endif


where $i is your array index



aslo you can modify your rules and message like:



 public function rules(){
return [
'serialnumber.0' => 'required|unique:borrowed,serialnumber,null',
'serialnumber.1' => 'required|unique:borrowed,serialnumber,null',
'serialnumber.2' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}


or



public function rules(){
return [
'serialnumber.*' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}


and



public function messages()
{
return [
'serialnumber.*' => 'Seems like you have added the same book more than once!',
];
}





share|improve this answer


























  • Where do i implement the "$i" cause it says its undefined and i dont know where to define it :o And thanks for the detailed answer!

    – Devi
    Nov 19 '18 at 12:30











  • @Devi check old value in your blade file like @foreach(old('serialnumber') as $i=>$value)

    – Tarun Saini
    Nov 19 '18 at 12:36











  • Is there anywhere an quotation marks mistake? In the Input field

    – Devi
    Nov 19 '18 at 12:50











  • And my input field disappears when i implement the if and the foreach..

    – Devi
    Nov 19 '18 at 13:11











  • this is only for old values when you got errors otherwise use simple html input

    – Tarun Saini
    Nov 19 '18 at 13:17














1












1








1







Change your view:



@if(!empty(old('serialnumber')))
@foreach(old('serialnumber') as $i=>$value)
<input id="serialnumber" type="text" class="form-control{{ $errors->has('serialnumber') ? ' is-invalid' : '' }}" name="serialnumber" value="{{ old('serialnumber.'.$i) }}" required @if (Session::has('autofocus')) autofocus @endif>

@endforeach
@endif


where $i is your array index



aslo you can modify your rules and message like:



 public function rules(){
return [
'serialnumber.0' => 'required|unique:borrowed,serialnumber,null',
'serialnumber.1' => 'required|unique:borrowed,serialnumber,null',
'serialnumber.2' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}


or



public function rules(){
return [
'serialnumber.*' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}


and



public function messages()
{
return [
'serialnumber.*' => 'Seems like you have added the same book more than once!',
];
}





share|improve this answer















Change your view:



@if(!empty(old('serialnumber')))
@foreach(old('serialnumber') as $i=>$value)
<input id="serialnumber" type="text" class="form-control{{ $errors->has('serialnumber') ? ' is-invalid' : '' }}" name="serialnumber" value="{{ old('serialnumber.'.$i) }}" required @if (Session::has('autofocus')) autofocus @endif>

@endforeach
@endif


where $i is your array index



aslo you can modify your rules and message like:



 public function rules(){
return [
'serialnumber.0' => 'required|unique:borrowed,serialnumber,null',
'serialnumber.1' => 'required|unique:borrowed,serialnumber,null',
'serialnumber.2' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}


or



public function rules(){
return [
'serialnumber.*' => 'required|unique:borrowed,serialnumber,null',
'ma_id' => 'required',

];
}


and



public function messages()
{
return [
'serialnumber.*' => 'Seems like you have added the same book more than once!',
];
}






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 19 '18 at 12:34

























answered Nov 19 '18 at 12:22









Tarun SainiTarun Saini

753




753













  • Where do i implement the "$i" cause it says its undefined and i dont know where to define it :o And thanks for the detailed answer!

    – Devi
    Nov 19 '18 at 12:30











  • @Devi check old value in your blade file like @foreach(old('serialnumber') as $i=>$value)

    – Tarun Saini
    Nov 19 '18 at 12:36











  • Is there anywhere an quotation marks mistake? In the Input field

    – Devi
    Nov 19 '18 at 12:50











  • And my input field disappears when i implement the if and the foreach..

    – Devi
    Nov 19 '18 at 13:11











  • this is only for old values when you got errors otherwise use simple html input

    – Tarun Saini
    Nov 19 '18 at 13:17



















  • Where do i implement the "$i" cause it says its undefined and i dont know where to define it :o And thanks for the detailed answer!

    – Devi
    Nov 19 '18 at 12:30











  • @Devi check old value in your blade file like @foreach(old('serialnumber') as $i=>$value)

    – Tarun Saini
    Nov 19 '18 at 12:36











  • Is there anywhere an quotation marks mistake? In the Input field

    – Devi
    Nov 19 '18 at 12:50











  • And my input field disappears when i implement the if and the foreach..

    – Devi
    Nov 19 '18 at 13:11











  • this is only for old values when you got errors otherwise use simple html input

    – Tarun Saini
    Nov 19 '18 at 13:17

















Where do i implement the "$i" cause it says its undefined and i dont know where to define it :o And thanks for the detailed answer!

– Devi
Nov 19 '18 at 12:30





Where do i implement the "$i" cause it says its undefined and i dont know where to define it :o And thanks for the detailed answer!

– Devi
Nov 19 '18 at 12:30













@Devi check old value in your blade file like @foreach(old('serialnumber') as $i=>$value)

– Tarun Saini
Nov 19 '18 at 12:36





@Devi check old value in your blade file like @foreach(old('serialnumber') as $i=>$value)

– Tarun Saini
Nov 19 '18 at 12:36













Is there anywhere an quotation marks mistake? In the Input field

– Devi
Nov 19 '18 at 12:50





Is there anywhere an quotation marks mistake? In the Input field

– Devi
Nov 19 '18 at 12:50













And my input field disappears when i implement the if and the foreach..

– Devi
Nov 19 '18 at 13:11





And my input field disappears when i implement the if and the foreach..

– Devi
Nov 19 '18 at 13:11













this is only for old values when you got errors otherwise use simple html input

– Tarun Saini
Nov 19 '18 at 13:17





this is only for old values when you got errors otherwise use simple html input

– Tarun Saini
Nov 19 '18 at 13:17


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372854%2fcustom-error-messages-after-submitting-data-laravel%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?