How to undelete a soft deleted Eloquent row?

Laravel: How to undelete a soft deleted Eloquent row?

Use the restore() method.

  1. User::withTrashed()->where("id",1)->restore()

webdevetc profile pic
webdevetc

I am a 29 year old backend web developer from London, mostly focusing on PHP and Laravel lately. This (webdevetc.com) is my blog where I write about some web development topics (PHP, Laravel, Javascript, and some server stuff). contact me here.



More...


Comments and discussion about How to undelete a soft deleted Eloquent row?

Found this interesting? Maybe you want to read some more in this series?

Or see other topics in the Laravel language

Or see other languages/frameworks:
PHP Laravel Composer Apache CentOS and Linux Stuff WordPress General Webdev and Programming Stuff JavaScript
Or see random questions

What is Agile software development?

How to convert a string to an array of it's characters in PHP?

How to return JSON data to the user in Laravel?

How to query mysql using PDO in PHP?

What is the difference between var, let and const in Javascript?

How could you include a custom function for every single time PHP runs?

How to find the intersection (same values) from two arrays?

How to change the order that migrations happen?

What is the loop variable in a @foreach loop in Blade?

What is Bubble sort, and how to write an implementation of it in PHP