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 EPRDF material, this is part 15 inside this video.
We're going to create an API for updated information.
If I back to Ed in the last video, step by step, we had done for this pre-heat list and we have done
get single important detail.
Now, this time will work for updated API.
So inside this update API, we need to pass the parameters.
It means updated employee information as well as employee ID on the behalf of this employee ID.
What we are getting inside this ID variable will update the existing data by the help of Body Palmettos.
What we will get via request instance.
So here inside this method block, first of all, we need to check that the employee accessed on the
behalf of this idea or not.
So let's say if employee will use Vehle method, let's ID equals to idee and we will use access to method.
If employee accessed, then we will go inside this if block, otherwise we will go inside this as block.
So in the last video we had handled the same situation.
So I will copy this massive something employee not phone call inside this ls blocked and pasting it
here.
Now inside this safe block it means we have no employee.
So what I will do this employee.
Equals to employ we will use find method and inside this find method, we will pass employee ID here.
What fine method will do, find martyring.
Laravel basically finds the data on the behalf of primary key.
As we can see here, that inside this will matter we have a specified the column.
But inside this find method, we haven't specified that this idea is compared with the idea column.
Automatically, this find method will decide with the primary key.
So after finding details, what I will do, we need to update the existing data.
So here, let's employ we to update our new value.
So let's request name here.
Now, if I copy paste a few more times, the second is Follett's email.
I will copy pasting you to till next.
We have something for the phone number.
Copy paste.
Here we have for the gender will copy and paste and for the last time that we have called each here.
So let's add that and one more thing.
While updating information, we want some form validation as well.
But here we are discussing all about update employed method.
So this time we are not going to implement some type of validation because while updating any information,
this information is either required or not.
Let's add that we have a case when we want to update all information, but also we have the second case
in which we want to update only phone number so we can specify the phone validation like all the files
are required in the case of update employee API.
So instead, what I will do, we need to check that if not empty, it means inside of body parameters.
If the names exist and if it has a value, then in that situation we need to update with updated value.
Otherwise, employee and name, we will update our name filled with the existing value.
What this line means, this line means that if we are passing the name value inside body for update,
let's say for the new value, if the new value exists and it is not empty, then we will update.
Otherwise the existing value will be updated.
So seem really to repeat for all the columns, if I copy and paste, copy and paste, copy and paste
and file a copy and paste, not going to change the keys.
So email, copy and paste.
Next we have for the phone number so I will copy.
For the gentle.
And finally, for The Age.
So after updating information, we to return a response that is yuzu has been updated, so let's return
response, Dewson mattered.
It's a status equals to one message.
Employ updated successfully, I'll save all the U.S. food and also if you want to specify the US to
good, we can do it here, but by default it will return to hundred.
Now, if you go inside this EPA dot, so to call this methode update, employ the syntaxes something
update employee re to use put request type and also need to pass the employee ID into the humoral.
So back to Postman.
First of all, I will copy this syntax.
It means that you are like localhost epis single employers and all.
But inside this case we have updated one employee, so I will copy Cohill.
And let's add that by default, if we want to update 28, I'd put a request.
I had 28 ideas.
We know that this this does not exist in our table.
So when we pressed the button employee not found, but when we passed the two value, as we know that
it excessed analyser that for this second no employee I.D., we want to update this name value.
So he'll go he'll Hadass, we will pass content type equal to application, Jason.
Accept application, Jason, go to body roll and inside these two to pass if we want to update the new
value only Vijay Kumar Singh.
This is the name what we have written as updated value instead of this old value.
Now, when we press the send button status equals to OK, employee update updated successfully.
Now, if you go back to this Epper, which is listing all the employees, click on send button.
And I think that the employee has not been updated if we go back to Ed.
And if you go inside to update employ method, here we are finding the details, updating all the informations
and one more thing, actually, the most important thing we forgot to add using save method.
Because without save mattered, how can we update the information to database so simply employ and save
all we have done?
So if we save all these changes to Postman, go here.
Let's say update employee to now press send button employee updated successfully.
Go to the list of Epis, click on Send Button and as you can see that the name has been updated.
Now one more time.
If we want to update the information of this Tuddenham we employed its name and gender.
So how can we update simply Google Plus employee IDs equals to three?
Litsa, we want to name the date he'll.
This is the name and he'll be want to update the gender, so it's a female.
So on behalf of this third no employee, I'd be updating this information.
Click on send button employee updated successfully.
Goodhue if we click on Send Button.
And as you can see that the name has been updated and the gender has been updated so successfully.
Guys, this is the EPA concept vehicle.
We have implemented update concept and this is we have used put request type.
Here we are finding the employer exists or not, if we exist, we are finding all the details, updating
all the existing values and saving inside our table.
And if employed does not exist, simple, we have to response as employee not found in the next video,
we will work over the last play of this epic Anthoula concept for delete employee so far this session.
Guys, thank you 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.