Laravel 6 Beginner - e8 - Form Validation

  Рет қаралды 48,863

Coder's Tape

Coder's Tape

Күн бұрын

Form validation is one of the coolest features of Laravel and one that is very useful. Let's explore how to refactor our previous Services code to be able to add new services using a form. Then, let's talk about Mass Assignment and how to fix it.
For the best experience, follow along in our interactive school at www.coderstape...
Laravel Validation Rules
laravel.com/do...
DigitalOcean Referral
m.do.co/c/7dce...
About This Course
If you have been looking to learn Laravel, there hasn't been a better time. The framework reached an important point in its life, with the release of Laravel 6. There has never been more demand for Laravel developers than now. In this series, we are going to get you started in your path to becoming a Laravel Artisan. Let's get right to it!

Пікірлер: 66
@sumankathet2560
@sumankathet2560 4 жыл бұрын
Best Laravel instructor on the planet....
@CodersTape
@CodersTape 4 жыл бұрын
Thanks
@binodthakur6113
@binodthakur6113 3 жыл бұрын
I know laravel tittle but this man enhance my knowledge on laravel. So much love from India. Thanks a lot. May god bless you and your bring more nice ideas and project.
@shahidmehboob8862
@shahidmehboob8862 4 жыл бұрын
man you deserve million of subscribers and likes.
@scientist.entity6609
@scientist.entity6609 5 жыл бұрын
thank you a lot for your videos on Laravel, im french and i can tell u it's ez to understand with you
@daleryanaldover6545
@daleryanaldover6545 4 жыл бұрын
I worked with Rails applications and the way you follow convention is pretty solid man, great series so far on Laravel!
@ovidiublaga1
@ovidiublaga1 4 жыл бұрын
i can not freaking believe it. SO GOOD EXPLANATIONS!
@CodersTape
@CodersTape 4 жыл бұрын
Thanks!
@FMINSIGHTS
@FMINSIGHTS 4 жыл бұрын
Thanks for the smooth explanation
@blendersky9977
@blendersky9977 4 жыл бұрын
what a playlist am actually watching it like netflix series...thankyou bro
@sathirakittisukmongkol776
@sathirakittisukmongkol776 4 жыл бұрын
Amazing tutorial. You make me have good experience in Laravel. Thanks! 😍
@milos5247
@milos5247 4 жыл бұрын
Great playlist if you want to learn MVC in general.
@viduvick
@viduvick 4 жыл бұрын
This is the most didactic tutorial i've ever seen! congrats and thanks!
@avinashpawar51
@avinashpawar51 5 жыл бұрын
That was amazing tutorial. Learnt new things.
@miguelCarrascoQ
@miguelCarrascoQ 5 жыл бұрын
love the way you explain
@arj7596
@arj7596 4 жыл бұрын
Good explanation
@jayantrawat5961
@jayantrawat5961 5 жыл бұрын
This organizing folder stuff made my coding life much easier :)
@CodersTape
@CodersTape 5 жыл бұрын
it's a no brainer, you just do it and it works.
@jayantrawat5961
@jayantrawat5961 5 жыл бұрын
@@CodersTape yeah!! haven't heard from anyone about this. This is the first time I starting work on any MVC. I am glad that I found your channel.
@arsalanhussain6499
@arsalanhussain6499 5 жыл бұрын
As always great tutorial very very helpfull
@maheshlowe907
@maheshlowe907 3 жыл бұрын
Highly recommended video series. BTW what are the formaters used to php, blade, html formatting?
@mosesegboh
@mosesegboh 3 жыл бұрын
Hello, great tutorial, please how can i stop the form from deleting user input during validation??
@nomankhan-st2dp
@nomankhan-st2dp 4 жыл бұрын
you are the best
@ProgrammingwithPeter
@ProgrammingwithPeter 5 жыл бұрын
You didn't talk about custom requests...which is a feature of laravel and it is recommended since you can extract that logic outside of the controller
@codehunter1366
@codehunter1366 4 жыл бұрын
Wow. thank you for sharing its a big help.
@elx5841
@elx5841 4 жыл бұрын
Thank you for your helpful videos. I have one question regarding the shortened version of the create: method you invoked through the Service Model: $data = request()->validate(['name'=>'required|min:5:max:10']); \App\Service:create($data); What if I have a variable that I need to insert into the database that will not be coming from the POST? EG: $data = request()->validate(['name'=>'required|min:5:max:10']); $data['value'] = 'THIS IS A STATIC VALUE'; \App\Service:create($data); How do I achieve this?
@adam192021
@adam192021 5 жыл бұрын
The BEST as always!
@Aecy
@Aecy 5 жыл бұрын
You can do FormRequest for the validation, it's better (for me and more clean).
@CodersTape
@CodersTape 5 жыл бұрын
I agree with you in that adding that abstraction is nice on larger forms, however, it's not as straight forward to understand to a newcomer to Laravel. Better to keep it simple until ABSOLUTELY necessary.
@Aecy
@Aecy 5 жыл бұрын
@@CodersTape Of course, you're right but I did not say it was the best solution for beginners :)
@nataliapalweski2072
@nataliapalweski2072 4 жыл бұрын
on showing error why form input field is reset to empty? according to Laravel documentation it is saying "Laravel allows you to keep input from one request during the next request. This feature is particularly useful for re-populating forms after detecting validation errors. However, if you are using Laravel's included validation features, it is unlikely you will need to manually use these methods, as some of Laravel's built-in validation facilities will call them automatically." I don't wanna use old() method
@randomguy5922
@randomguy5922 4 жыл бұрын
i am using maatwebsite excel package, is there a way to import data and check validation on some specific fields, if any record fails to match validation, record the whole rows in a report excel file with the error message or red color in that field text which are not proper (the reason why validation failed) and then finally after full import have and option to download error excel file. So that we can correct the fields and upload that file again.Do you have any tutorial like this. I will be highly thankful if you guide me how to do this, i have tried to read the maatwebsite excel package documentation, but it is not very much clear to me.
@ShahinShateri
@ShahinShateri 4 жыл бұрын
what if we want the text field's name to be "serviceName" but the validation error message shows "The service field is required."? how can we do that?
@silvijabojkovski5053
@silvijabojkovski5053 3 жыл бұрын
It says that $message is not defined.... What should I do? I use version 5.4.36
@AmeerulIslam
@AmeerulIslam 4 жыл бұрын
I think you should have said that this line: "protected $fillable" and "protected $guarded" are default properties in class Model and we are overriding it. Isn't that's what we're doing here?
@zombiesbyte331
@zombiesbyte331 4 жыл бұрын
I've never understood the csrf token thing. Wouldn't you just gab the value before sending over a form submission from an external site? It only protects if you don't grab that freely and readily available token. i.e. coderstape.com login form has this token ciIWBQoEmDqP30fHTVvdvK6lIg7advnSKgzQtior, now I'd be able to submit a form using this token. I'd need to grab the next token generated to do it again but my point is; how does this stop or hinder anything, a script would quite easily grab these tokens for me on each round of cross-site submissions?
@jaryalbhau
@jaryalbhau 5 жыл бұрын
Sir!! Can you make a video on send email to another using webmail with smtp configuration
@linguapharm
@linguapharm 5 жыл бұрын
kzbin.info/www/bejne/n4LSg5uVbrGeoLc
@vigilantezack
@vigilantezack 4 жыл бұрын
I'm not sure I understand the mass field creation protection thing. If the fields were not in the submitted form, or fields don't exists in the DB, what's the problem?
@CodersTape
@CodersTape 4 жыл бұрын
data injection is the short answer. long answer let's imagine an example where you have a field in the user's table to determine their subscription level. If a user was able to figure that out, they could pass in their arbitrary fields into your database by modifying the form in their browser.
@vigilantezack
@vigilantezack 4 жыл бұрын
@@CodersTape yep I can see that. But there must be cases where updating a field like that would be proper. So then I assume you can bypass that setting and updated it just the same? Like when a user first signs up you'll probably set that field for the first time.
@younesmarouf2200
@younesmarouf2200 4 жыл бұрын
Hey i'm a beginner i'm watching your videos and i like them i just have a question how to prevent multiple submitting in one button ex : when i click add customer twice all information duplicate in my db and again thank you for your tutorial
@kiefferganza169
@kiefferganza169 5 жыл бұрын
does laravel validation only work with eloquent models?
@CodersTape
@CodersTape 5 жыл бұрын
Request validation has nothing to do with eloquent. It just validates the request, not the model.
@CodersTape
@CodersTape 5 жыл бұрын
Request validation has nothing to do with eloquent. It just validates the request, not the model.
@kapa4208
@kapa4208 5 жыл бұрын
Can you please explain to me a bit about namespace, what's the difference between "\App\Model\" and "App\Model"? I saw Jeffrey uses "App\Model" in the Laracasts tutorial. So I'm not sure which convention to use.
@CodersTape
@CodersTape 5 жыл бұрын
The difference has to do with the current file that you’re in. What I mean by that is that if you’re in a file that has the namespace App already. Here’s what would happen. \App\Model would stay as \App\Model but App\Model would tag on to the already existing namespace and give you \App\App\Model which is not what you want.
@kapa4208
@kapa4208 5 жыл бұрын
@@CodersTape Ahh I see. Thanks for the answer, I'll stick with the \App\... convention.
@dgloria
@dgloria 4 жыл бұрын
@csrf was never mentioned in any Laravel tutorials I watched so far.
@romimaximus
@romimaximus 4 жыл бұрын
hmm.. after i did add the new dedicated controller, laravel couldnt find my layout, views and nothing else and gave a big error "ReflectionException" and "Kernel does not exist'"...i couldnt fix it ..and i had to remake my whole code again....its frustating..!!! i dont know what happen...!! lol..
@hiteshaloney
@hiteshaloney 5 жыл бұрын
How to work with ajax calls and dynamic forms in laravel ?
@itsumarejaz
@itsumarejaz 4 жыл бұрын
Is there any naming convention for Controllers? In freeCodeGram Project, controller names were ProfilesController, PostsController, as there can be many profiles and posts. Similarly, services can be many, so shouldn't ServiceController be named ServicesController?
@CodersTape
@CodersTape 4 жыл бұрын
There was a change in Laravel convention into singular controller names so I made the change as well. Up to you, just pick one and stay consistent with that
@itsumarejaz
@itsumarejaz 4 жыл бұрын
@@CodersTape Sure
@sezohessen7485
@sezohessen7485 4 жыл бұрын
Note: if there is any error doesn't logic use command php artisan optimize
@mdfayaz3341
@mdfayaz3341 4 жыл бұрын
I only subscribe who, i think are best, I've subscribed you
@sunwavesonmars7588
@sunwavesonmars7588 3 жыл бұрын
i can create but cant update it , weird
@alfredocarreon4449
@alfredocarreon4449 4 жыл бұрын
how to customize a validation error message? ex: a name that needs to have a minimum length of 30 (rule would be min:30) instead of "The name must be at least 30 characters.", i want it to be "Name length too short. (Minimum of 30 characters)."
@marcinb8038
@marcinb8038 4 жыл бұрын
you have to edit validation.php in resources/lang/en as it is stated in documentation
@createforpeople
@createforpeople 5 жыл бұрын
But request validation will be better way ;)
@caterpilar
@caterpilar 4 жыл бұрын
Don't forget to turn off fields of created_at and updated_at, if you don't need them in table. To do that in your model write class Cl_name extends Model { public $timestamps = false; }
@nac9880
@nac9880 4 жыл бұрын
and remove $table->timestamps() from migration to prevent the creation of these fields in first place
@sangeetha1421
@sangeetha1421 5 жыл бұрын
Source code please
@CodersTape
@CodersTape 5 жыл бұрын
I’ll get it posted up on Github under the Coder’s Tape repo.
@blakebrady3586
@blakebrady3586 2 жыл бұрын
I want to buy this tool, because I want to scam bank email,
@Alphabet_-_
@Alphabet_-_ 5 жыл бұрын
Laravel 6 Beginner - e9 - RESTful Controllers Part 1
18:09
Coder's Tape
Рет қаралды 36 М.
Snippet: Multiple Input Validation in Laravel
15:50
Codecourse
Рет қаралды 56 М.
Sigma baby, you've conquered soap! 😲😮‍💨 LeoNata family #shorts
00:37
How to whistle ?? 😱😱
00:31
Tibo InShape
Рет қаралды 21 МЛН
Laravel 6 Beginner - e6 - Blade Templates
15:24
Coder's Tape
Рет қаралды 54 М.
Laravel 6 Beginner - e11 - RESTful Controllers Part 3
13:28
Coder's Tape
Рет қаралды 19 М.
Laravel 6 Beginner - e10 - RESTful Controllers Part 2
17:20
Coder's Tape
Рет қаралды 23 М.
Laravel 6 Advanced - e1 - Service Container
23:27
Coder's Tape
Рет қаралды 274 М.
Laravel 6 Beginner - e7 - MySQL Database & SQLite
20:47
Coder's Tape
Рет қаралды 48 М.
I built 10 web apps... with 10 different languages
14:23
Fireship
Рет қаралды 1,6 МЛН
I built the same app 10 times // Which JS Framework is best?
21:58
Fireship
Рет қаралды 2,5 МЛН
Laravel 6 Advanced - e8 - Lazy Collections & PHP Generator
20:28
Coder's Tape
Рет қаралды 35 М.
Laravel 6 Advanced - e4 - Facades
24:33
Coder's Tape
Рет қаралды 61 М.