Answers for "validator errors laravel"

PHP
2

laravel get errors from validator blade

<!-- /resources/views/post/create.blade.php -->

<h1>Create Post</h1>

@if ($errors->any())
    <div class="alert alert-danger">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif

<!-- Create Post Form -->
Posted by: Guest on August-22-2020
0

what is validator in laravel

$validator = Validator::make(
    [
        'name' => 'Dayle',
        'password' => 'lamepassword',
        'email' => '[email protected]'
    ],
    [
        'name' => 'required',
        'password' => 'required|min:8',
        'email' => 'required|email|unique:users'
    ]
);


if ($validator->fails())
{
    // The given data did not pass validation
}
Posted by: Guest on June-12-2021

Code answers related to "validator errors laravel"

Browse Popular Code Answers by Language