I was deal WITH softDeletes trait, and when I use the history method as exists in the docs the Call to undefined method App\Models\User::history() issue is triggered, here is my code
public function restoreUser(Request $request)
{
$user_id = $request->route()->parameter('user');
$user = User::onlyTrashed()->get()->find($user_id);
if ($user->trashed()) {
$user->history()->restore();
}
return redirect()->route('users.trashed');
}
I was deal WITH
softDeletes
trait, and when I use thehistory
method as exists in the docs theCall to undefined method App\Models\User::history()
issue is triggered, here is my code