public function findSubcatagory() { $input = Input::get("catagory"); $subcatagorys = Subcatagory::where('catagory_id', $input); if ($subcatagorys->count() > 0) { foreach ($subcatagorys->get() as $subcatagory) { echo '<option value="' . $subcatagory->id . '">' . $subcatagory->subcatagory_name . '</option>'; } } }
/** * Delete catagory */ public function deleteCatagory($id) { $catagory = Catagory::find($id); Subcatagory::where('catagory_id', $id)->delete(); Product::where('catagory_id', $id)->delete(); if ($catagory->delete()) { return Redirect::back()->with('event', '<p class="alert alert-success"><span class="glyphicon glyphicon-ok"></span> Catagory has been successfully deleted</p>'); } else { return Redirect::back()->with('event', '<p class="alert alert-danger"><span class="glyphicon glyphicon-remove"></span> Something went wrong. Please try after sometime</p>'); } }