/** * Return json response to ajax request and change the status of the testimonial */ private function update_status($id, $new_status) { $testimonial = Testimonial::find($id); if (is_null($testimonial)) { return response()->json(['message' => 'Testimonial not found'], 400); } $testimonial->status = $new_status; $testimonial->save(); return response()->json(['message' => 'Status updated with success'], 200); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { Testimonial::find($id)->delete(); return redirect('/admin/testimonial'); }