middleware('auth'); $this->middleware('role:User'); $this->middleware('permission:structure.market'); } public function displayAddMarketTax() { return view('market.add.display'); } public function storeAddMarketTax(Request $request) { $this->validate($request, [ 'tax' => 'required', ]); $charId = auth()->user()->getId(); //Declare the esi helper $esiHelper = new Esi; //Create the esi container to get the character's public information $esi = new Eseye(); try { $charInfo = $esi->invoke('get', '/characters/{character_id}/', [ 'character_id' => $charId, ]); } catch(RequestExceptionFailed $e) { return redirect('/market/add')->with('erorr', 'Failed to get character info.'); } $ratio = $request->tax / 2.5; $corpMarket = new CorpMarketStructure; $corpMarket->character_id = $charId; $corpMarket->corporation_id = $charInfo->corporation_id; $corpMarket->tax = $request->tax; $corpMarket->ratio = $ratio; $corpMarket->save(); return redirect('/dahsboard')->with('success', 'Market structure recorded.'); } public function displayTaxes() { $charId = auth()->user()->getId(); $esi = new Eseye(); try { $charInfo = $esi->invoke('get', '/characters/{character_id}/', [ 'character_id' => $charId, ]); } catch(RequestExceptionFailed $e) { return redirect('/market/add')->with('erorr', 'Failed to get character info.'); } //Get the total taxes from the database for each of the 3 months in the past } }