mercredi 19 février 2020

how to access validation error property name in Laravel?

I have from in Laravel and I try to get validate it and see errors for each input, I already loop through $error->all() but I need to show the errors of each input under it and I use this code $errors->has('password') to show input have an error but I need to show message too. I get print_r($errors) and It return this:

Illuminate\Support\ViewErrorBag Object
(
    [bags:protected] => Array
        (
            [default] => Illuminate\Support\MessageBag Object
                (
                    [messages:protected] => Array
                        (
                            [firstName] => Array
                                (
                                    [0] => The first name field is required.
                                )

                            [lastName] => Array
                                (
                                    [0] => The last name field is required.
                                )

                            [email] => Array
                                (
                                    [0] => The email must be a valid email address.
                                    [1] => The email field is required.
                                )

                            [password] => Array
                                (
                                    [0] => The password field is required.
                                )

                            [password_confirmation] => Array
                                (
                                    [0] => The password confirmation field is required.
                                )

                        )

                    [format:protected] => :message
                )

        )

)

My problem is I can't how can access the messages?



via Chebli Mohamed

1 commentaire:

  1. If you're looking to lose weight then you need to start using this totally brand new custom keto meal plan.

    To design this keto diet, certified nutritionists, personal trainers, and professional cooks have joined together to develop keto meal plans that are productive, painless, price-efficient, and delicious.

    From their launch in January 2019, 1000's of clients have already transformed their body and well-being with the benefits a smart keto meal plan can offer.

    Speaking of benefits: clicking this link, you'll discover 8 scientifically-tested ones offered by the keto meal plan.

    RépondreSupprimer