1
我試圖恢復softdeleted數據,但我只是不停收到此錯誤 Call to undefined method stdClass::restore()調用未定義的方法stdClass的::關於恢復軟刪除
我的路線恢復()這個樣子
Route::resource('/dvd', 'DvdController');
Route:get('dvd/{id}/restore', '[email protected]');
這是我的控制器
public function restore($id)
{
//Dvd::withTrashed()->where('id','=',Input::get('id'))->restore();
//Dvd::find($id)->restore();
$dvds = DB::table('dvds')->where('id', $id)->first();
$dvds->restore($id);
$view = redirect('dvd')->with('message', 'Data berhasil di-restore');
return $view;
}
我調用該方法從按鈕
<a style="margin-bottom: 5px;" class="btn btn-small btn-primary btn-block"
href="{{ URL('dvd/' . $data->id . '/restore') }}">Restore</a>
我不知道我出錯了,我是PHP和laravel上的新手,請包含正確的代碼。 謝謝