/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Requests\RackRequest $request) { // $data = $request->except('_token'); Rack::create($data); return back(); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { // if ($request->has('company_id')) { $company_id = $request['company_id']; session(["layout_company_id" => $company_id]); } else { if ($request->session()->has('layout_company_id')) { $company_id = $request->session()->get('layout_company_id'); } else { $company_id = 2; } } $racks = Rack::with(['company', 'networkDevice'])->where('company_id', $company_id)->get(); return view('racklayouts.index')->with('racks', $racks); }
public function rack($id) { Rack::find($id)->delete(); return back(); }