Home>

I have set required validation in the Laravel input form.
When I submit the form blank, I get an error message.
The content (text) is not displayed.

Sorry for the rudimentary question
I don't know the cause.
Please professor.

//form.blade.php
    {!! Form :: open (['route' =>'corp.confirm']) !!}
        
            {!! Form :: label ('corp_name','company name') !!}
            {!! Form :: text ('corp_name', old ('corp_name'), ['class' =>'form-control']) !!}
             @if ($errors->has ('corp_name'))<span>{{$errors->first ('corp_name')}}</sapn>@endif
        
//abridgement
        {!! Form :: submit ('confirm', ['class' =>'btn btn-primary']) !!}
    {!! Form :: close () !!}
//FormController.php
    public function confirm (Request $request)
    {
        $this->validate ($request, [
            'corp_name' =>' required',
            //abridgement
        ]);
//resources/lang/en/validation.php
//abridgement
'required' =>'The: attribute field is required.',

The error message is displayed as "validation.required".

Why doesn't it become "The: attribute field is required.'"?

It's Laravel 5.5.

  • Answer # 1

    / **
     * Save new blog post
     *
     * @param Request $request
     * @return Response
     * /
    public function store (Request $request)
    {
        $validatedData = $request->validate ([[
            'title' =>' required | unique: posts | max: 255',
            'body' =>'required',
        ]);
        // Blog post is valid
    }


    Laravel 5.5 Official Document Japanese Translation (Unofficial)

    Let's pass the array as the first argument. (In the first place$this->not$request->)

  • Answer # 2

    I have set'locale'=>'ja', in config/app.php
    It seems that it is displayed like that when the target language file does not exist.
    Please change it back to'en'or put the same validation file on the ja side.

    You can get the Japanese validation file from here.
    https://readouble.com/laravel/5.5/ja/validation-php.html