How to Update (CRUD) | Laravel 10 Tutorial #16

How to Update (CRUD) | Laravel 10 Tutorial #16

Yelo Code

1 год назад

8,897 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@PedroCoelho98
@PedroCoelho98 - 22.07.2023 01:25

Great series. Super well explained, practical examples with no nonsense theoretical stuff.
What a breeze to dive into.
Future video ideas if you need:
- how to deploy the project;
- how to take a project from another developer. How to get familiar with it, how to develop on top of it, etc.
Keep up the good work!

Ответить
@brianrieman5898
@brianrieman5898 - 07.10.2023 12:34

From a database perspective the 'update' method shown in this video creates a 'new' entry/row on the ideas database table - i.e. because the update method shown is not using any "where" clause to select a 'id'/row from the db table.

However based on approach(es) in your earlier video on the delete method - the following seems to provide the desired 'update' result:

public function update($id)
{

request()->validate([
'content' => 'required|min:5|max:240'
]);

$idea = Idea::where('id', $id)->firstOrFail();
$idea->content = request()->get('content', '');
$idea->save();

return redirect()->route('ideas.show', $idea->id)->with('success', "Idea updated successfully");
}

Ответить
@lesssass4478
@lesssass4478 - 11.01.2024 14:48

The $editing thins does not work for me. Any guesses?

Ответить
@KhalilMhiri-f8o
@KhalilMhiri-f8o - 14.08.2024 20:43

Sir pls source code of this project

Ответить
@concretei3563
@concretei3563 - 04.09.2024 03:38

My update works, however i dont get the success message eventhough my code is exactly the same as shown

Ответить
@KulasTayag
@KulasTayag - 18.10.2024 05:47

this left me confuse and frustratedd

Ответить