Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dryant's avatar

validation.required instead correct message

Hi!

When Laravel returns a validation error, I don't get correct message in validation.php file. I only get a 'validation.required' message. I have in my config file 'en' selected, and match with lang/en folder. Can someone help me please?

Thanks

0 likes
2 replies
dryant's avatar

Yes, Sinnbeck, is the same. My validator:

 public function store(Request $request)
    {
        $validated = $request->validate([
            'title' => 'required|unique:widgets|max:50',
            'content' => 'required|min:25',
            'location' => 'required',
            'active' => 'required'
        ]);

        $widget = Widget::create($request->all());
        return $request;
    }

my blade file:

{!! Form::open (['route' => 'admin.widgets.store', 'autocomplete' => 'off']) !!}
            @csrf
            <div class="row">
                <div class="col-md-6 col-xs-12">
                    <div class="form-group">
                        {!! Form::label('title', 'Título',['class' => 'form-label ']) !!}
                        {!! Form::text('title', old('title'), ['class' => 'form-control ', 'placeholder' => 'Titulo del widget']) !!}
                    </div>
                    @error('title')
                        <p class="alert alert-danger">{{ $message }}</p>
                    @enderror
                </div>

                <div class="col-md-6 col-xs-12">
                    <div class="form-group">
                        {!! Form::label('location', 'Ubicación',['class' => 'form-label ']) !!}
                        {!! Form::select('location', ['sidebar' => 'sidebar', 'header'  => 'header', 'footer1'  => 'footer1', 'footer2'  => 'footer2', 'footer3'  => 'footer3', 'footer4'  => 'footer4'], null, ['placeholder' => 'Ubicación...?', 'class' => 'form-control ']) !!}
                        
                    </div>
                    @error('location')
                    <p class="alert alert-danger">{{ $message }}</p>
                    @enderror

Please or to participate in this conversation.