public function update(Request $request, Category $category)
{
// validation without id
$category->update($request->all());
return redirect()->route('categories.index');
}
In view
<form action="{{ route('categories.update', ['category' => $category]) }}" method="POST">
@csrf
@method('PUT')
<!-- inputs without id -->
</form>
madam should i need to change categories model to category ....why ?? i want to update id ...means i created a table inside database which name is categories so there are three column inside category id,name,status...i want when user update something so it will change according to selected id ... example id 1 is selected for update so it will update data of id 1 like name and status...
@redroseamit If your table in the migrations is correct you don't need to send the id, because Laravel will take care of that, updating the id yourself could be dangerous as the wrong id could be sent instead. I also second @thibaultvanc you should add a dd('here'); to debug and make sure you're even getting into the controller update function.
no sir i am confused ...sir can u please guide me what steps should i need follow .. can you please provide code for like i have categories table in database there are three column id name and status ....i want to perform create,update, and delete but only create and delete is working ...i will be more obliged ..
madam i made all the changes but now update button is not working.....its not functioning mean neither refreshing page nor updating its stuck continue on update page....
thank you so much madam , thanks a lot lot....i am obliged .... i was trying to fix this issue from 4 days and almost 4 days wasted behind it ...thank you again and thanks for your valuable efforts and kindness...