/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { if (States::isProtected($id)) { return $this->error("This item is protected"); } if (sizeof(States::all()) <= 2) { return $this->error("Do you really want to delete all States? In which state are you?!"); } if (Items::hasStatus($id) || Persons::hasStatus($id)) { return $this->error("Do you really want to delete all States? In which state are you?!"); } $data = States::find($id); if ($data) { $data->delete(); return $this->success($data); } else { return $this->error("Item doesn't exist"); } }
public function getEditStore($id) { $store = MerchantStore::with(['Address', 'tags', 'Merchant'])->where('id', $id)->first(); $tags = Tag::all(); $cities = Cities::all(); $areas = Areas::all(); $states = States::all(); $countries = Countries::all(); $output = ['store' => $store, 'tags' => $tags, 'areas' => $areas, 'cities' => $cities, 'states' => $states, 'countries' => $countries]; return view('admin.storeEdit', $output); }