Issue
I'm trying to create a validation such that if model_name is not unique, it will display a html link to view the existing model_name row. Something like this image, however my current code displays the message like this. What do I have to change in my code? Here's my code validation code:
'model_name.unique'=>'Model Already exists. <a href="'.route('view.models',[$request->model_name]).'">Go to page.</a>',
Thanks for any help.
Edit:
Here's the error part of my form:
<input type="text" name="model_name" class="form-control" id="exampleFormControlInput1" placeholder="Model Name">
@error('model_name')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
Solution
That escaped character. You can know more about it here and Laravel Docs.
So to be quick, you can try:
<input type="text" name="model_name" class="form-control" id="exampleFormControlInput1" placeholder="Model Name">
@error('model_name')
<span class="text-danger">{!! $message !!}</span>
@enderror
</div>
Answered By - Huy Phạm Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.