/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // delete $channel = Channel::find($id); if (!$channel) { return response()->json(['message' => "Unable to find channel by id:{$id}", 'code' => 404], 404); } $channel->delete(); return response()->json(['message' => "Channel id:{$id} has been deleted", 'code' => 200], 200); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $channel = Channel::find($id); if ($channel) { $channel->delete(); } return redirect()->action('Admin\\CatgWebboardController@index'); }