Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
OK, guys, welcome to the course of Lavallade et EPA, Dalip Historical, this is our partner, 23
inside this video.
We're going to create our first EPA, that is student producer EPA of this second phase of development.
So if I go back to Ed in the last video, we have configured all about EPA rules as well as this student
controller and their methods.
So to create a registry, EPA re to use this registry to go inside this.
So what are the steps we have to follow to create a registry?
EPA, first of all, after taking inputs by the help of this request instance, we want to do some validation
of all those data.
Next, we need to create data and finally send response for EPA.
So we need to follow the same steps, what we had done inside Freezone one development.
So inside validation.
Let's request dual use, validated method and inside is faded method will mcnairy and eviler destroying
any student.
What are the fields?
Actually we want if I go back to table, go to students, click on this structure.
So we need name, email, password and phone number back to Ed.
So we need name value, we need email value and we need Lizzi password.
And for now, let's add that this phone number is an optional parameter.
So first of all, we need to make a default to accept null value.
So we need to change the migration file.
So what I will do back to Edita going inside database migration's
here.
We have students migration file and we want to add the phone numbers would accept the null value.
So we will use nullable method.
Now we need to update this migration and load again to this database table.
So how can we do that terminal simply if BHP additions migrate and we will and refresh suppressing enter.
As you can see, that violating this command first, it rolled back all the tables and then migrated
all the tables.
Now, if you go inside this structure and as you can see that the phone number is now accepting the
null value.
So we need to create this field as an optional.
So we are not going to pass a phone number inside this validate.
So what I will do simply let's say this value should be required.
Now, if I copy this rule, go inside for this email address, male values would be required and for
the password, passwords would be required.
The rules I will attach for this email passing a pipe symbol, the e-mail.
This rule is going to check that the email address is a valid format or not.
Next, I will take that uniqueness.
So as we know that voice during all this to Tyneside still.
So from this table, I want that the email address of each specific rule should be unique.
So all we have done and inside is password.
I will add one more rule.
Something called confirmed.
These rules means that when we will do a student's registration, we need to pass the parameters as
name, email, password and password undercook information.
Because in this case we are not adding password underscore confirmation parameter inside this validate
any.
Instead, dynamically we will pass inside body parameter if we don't pass password, underscore confirmation
for the same value.
What we have inside is password filled that it will give in added something the password confirmation
field should be required to now successfully.
We have implemented all about the validation rules.
So if let's say that all the validation rules passed by our input values.
So after that we to create the values.
So for that we to import our student model.
So use student model, go here, create an instance.
So let's say student equals to a new student.
After that student, we have the film inside our table as equals to I will copy paste a few more times
after we have email address.
Next, we have Basswood.
After that, we have phone underscore.
No Salt-Water fulfills.
We have are going back to DB Jakiel.
So we have fulfilled.
We don't want this extra.
So get rid of that.
And hearing Saidi's name.
Relax is the new value via this request instanced.
So here we have the name value if I will copy go here.
This is for the email value.
Now we have the password.
And finally, we have for the phone number, so let the phone underscore number and as we know that
the phone number is optional value.
So first of all, read to take here.
That is it said it means this phone, Wookey Outfly will not if it is available.
So in that situation, we will pass this value.
Otherwise it will go with the empty value.
And one more thing that while registering youso means student inside a student's table we want a password
should be highest value.
Right now we are getting this password value in plain text.
So first of all, we need to convert into Haast format.
So for that we need to import use hash.
It is coming from Farzad Gourriel and simply I will use hash and it's Mique method.
So automatically after taking this input password value, which is a plain text, it will convert into
a hashed format.
And finally, after doing all this stuff next to let this student and save.
So what I will do this is for the validation and this is for the creating data.
So if I got all these quotes from here, go after this comment and pasting it here now, next, we need
to send a response or let's return response.
Jason, making an early little status equals to one message lets his student.
Registered
successfully.
All we have done now, we need to test this EPA, what we have created.
So I am opening Postman Tool to take this EPA.
So I have opened post here.
First of all, we need to start developing Servoz so we artesian sir pressing enter.
And if I copy the base, you to go inside boost based in the USA.
And as we know that we have configured all EPA doubts inside EPA dot BHP.
So we need to add EPA as a prefix.
So to call register out if I go here, EPA, dot, BHP, so to call this register which is calling register
methode v to pass Borst request I so we need to select he'll post request.
I go inside his head.
It's a content type read to pass application Jaeson accept its application.
Jason go inside this body, select a role and inside here will to pass all the parameters like what
we have taken as name email password.
For this rule we have password underscore confirmation our next phone number.
So if I go here, first of all, we need to check some validation errors.
So let's add that I will pass name here, which is which is containing null value.
Next, we have the email filled again, which is counting the null value and here is a password which
is containing null value.
So if I click on this send button and also read to our registrar here, because this is the road name
send button.
And here, as we can see that we are getting error messages.
That is the name for the required email field is required and password field is required.
So let's pass some value.
So I am passing the first student with this dummy email value password is from one to six.
If I click on this send button, as you can see, that we are getting Akina error message, that is
the password confirmation field, Mincberg password filled confirmation does not match.
So for that, we need to add one more property that is password on the school confirmation.
And this error we got because we have added confirmed as a rule inside this input field back to post
man.
So password confirmation we to pass exact the same value.
What we have inside is password filled.
So one, two, six.
Analysts add one more input value.
That is for the phone number.
So phone number, this is not required, but we will pass this value as well.
Now click on Send Button.
As you can see, that student registered successfully, not wi fight back to, but also click on Bob's
button.
And as you can see that we are getting our first student data.
Whitney email has a value of password.
As you can see, it is totally hacked.
And here is the phone number that's created.
One more user back to post.
Man, I will change.
And one more thing.
Let's test these credentials one more time.
As we know that inside this email, we have added a rule called Unique Souta D'Asti unique validation.
Click on Send Button.
And as you can see, that the e-mail has already been taken.
So I'm creating the second.
A student with this email value password will be seen mobile number.
This time something different value pressing send button student registered successfully but will show
you this page at this time.
Now we have two different rules.
Now in the next video, guys, we will create login API so far this session.
Guys, thanks for watching and have a great day.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.