public function edit() { // dd(Helper::test()); $attrs = Attribute::find(Input::get('id')); $attrSets = AttributeSet::get(['id', 'attr_set'])->toArray(); $attr_types = AttributeType::all(); $action = route("admin.attrs.save"); return view(Config('constants.adminAttrView') . '.addEdit', compact('attrs', 'attrSets', 'action', 'attr_types')); }
public function delete() { $attr = Attribute::find(Input::get('id')); $productAttrs = DB::table('has_options')->where("attr_id", Input::get("id"))->get(); //dd($productAttrs); if (empty($productAttrs)) { Attribute::find(Input::get('id'))->attributesets()->detach(); Attribute::find(Input::get('id'))->attributeoptions()->delete(); $attr->delete(); return redirect()->back()->with("message", "Attribute deleted successfully!"); } else { return redirect()->back()->with("message", "This attribute part of product!"); } }
public function update(Request $request, $type_id, $id) { $attribute = Attribute::find($id); $attribute->update($request->all()); return redirect(route('admin.type.{type_id}.attribute.index', $request->type_id)); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $attr = Attribute::find($id); $attr->delete(); return Redirect::to('admin/goods_types'); }