/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { ProductCategory::findOrFail($id)->delete(); return Redirect::action('ProductCategoryController@index'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { DB::transaction(function () use($id) { $user = Auth::user(); $productCategory = ProductCategory::findOrFail($id); $productCategory->updated_by = $user->name; $productCategory->deleted_by = $user->name; $productCategory->key = $productCategory->key . '-' . microtime(true); $productCategory->save(); // soft delete $productCategory->delete(); }); }