Hi everyone.
In this video I will show you how we can update a message.
Okay, so in order to update a message we will create a video.
I will allow the user can edit the the text of the message and the media file of the message.
Right.
So for that reason in this guy I will put the text we will string and media files will be media files.
Over here okay.
And the border is optional and is optional also okay.
And let's say inside the Soviet um we need to put the ID of the message.
Okay.
This is the ID of the message because this is the message of it okay.
We need to update the video And we need a current user.
I user my log.
Okay, firstly we need to find my array.
Okay.
So for a reason it is okay.
I will write it in here.
And after that inside update I will delegate the job into here.
Really I do.
And in here we need to change the screen.
And here we may screen also.
Okay.
After we already found the message, we need to check a little bit.
We need to check.
Right here.
We already checked the message already.
File.
Okay.
It means after that.
After this line of code, the message right here we will also have a data.
Okay.
And we need to check one more thing.
We need to check if the message dot center dot on the screen different with the current user underscore
ID we will throw the error also.
I will throw the new probability graph.
Okay, because I cannot update the message of the unknown user.
Okay, I only can update the message with my my user.
So after that we need to update the message right here.
Dot test equal the restructuring over here.
First, if not we will use the old data in the database and.
Modify basically the set.
Okay.
And make sure we await message dot sign.
And, uh, you may ask me how we can update the message.
Okay.
In later, in order to get the message, we will get all the media file.
Okay.
And we will replace it entirely.
For example, in lecture we have array with the public and a possible I one.
So this is our last okay.
In order to remove the message you just need to override entirely.
First of all I want to remove the bullet to which I need to override and send with a new array like
this.
Nadas.
Okay.
And it will remove the veto.
Okay.
If we want to replace.
Which I said entirely with the new one.
Okay.
I hope you understand this logic.
Okay, let's create the controller.
And that is.
Part.
Of the array part.
And in here I will fix this later.
Let me place.
That over here.
With of that.
With the current user.
Okay.
Let's open.
And base the message ID.
Is R here?
Let's go with the ID of the message.
Go here.
Let me duplicate.
Message.
Change the method to batch and message right here.
Let me remove it and put it over here okay.
This is the URL.
And, uh.
Go here.
All right.
Okay.
We have a, uh.
Hello?
Hi, there.
Okay.
I will call.
Now, you can say hello here.
This is empty.
All right.
Right.
I will call.
Hi, there.
Okay.
And I will vote with this thing.
Let me say we already have a method.
Success.
Let me refresh.
And you can say right now we already got the new media files.
It means the logic of the update already work.
So I hope you understand this logic right here.
And it doesn't hurt.
All right.
So I will see you in the next video.