middleware('auth'); $this->middleware('role:User'); $this->middleware('permission:structure.operator'); } public function chooseCorpTaxes() { $this->middleware('role:Admin'); $corps = CorpStructure::pluck('corporation_name', 'corporation_id'); return view('structures.admin.choosecorporation')->with('corps', $corps); } public function displayCorpTaxes(Request $request) { $this->middleware('role:Admin'); $corpId = $request->corpId; $months = 3; //Declare the structure tax helper class $sHelper = new StructureTaxHelper(); //Get the dates we are working with $dates = $sHelper->GetTimeFrameInMonths($months); foreach($dates as $date) { $totalTaxes[] = [ 'date' => $date['start']->toFormattedDateString(), 'tax' => number_format($sHelper->GetTaxes($corpId, 'Market', $date['start'], $date['end']), 2, '.', ','), 'revenue' => number_format($sHelper->GetRevenue($corpId, 'Market', $date['start'], $date['end']), 2, '.', ',') ]; } //Return the view with the data passed to it return view('structures.admin.choosecorptaxes')->with('totalTaxes', $totalTaxes); } public function displayTaxes() { //Declare new Lookup helper $helper = new LookupHelper(); //Declare the structure tax helper class $sHelper = new StructureTaxHelper(); $months = 3; $totalTaxes = array(); //Get the character's corporation from the lookup table or esi $corpId = $helper->LookupCharacter(Auth::user()->character_id); //Get the dates we are working with $dates = $sHelper->GetTimeFrameInMonths($months); //Get the market taxes for this month from the database foreach($dates as $date) { $totalTaxes[] = [ 'date' => $date['start']->toFormattedDateString(), 'tax' => number_format($sHelper->GetTaxes($corpId, 'Market', $date['start'], $date['end']), 2, '.', ','), 'revenue' => number_format($sHelper->GetRevenue($corpId, 'Market', $date['start'], $date['end']), 2, '.', ',') ]; } return view('structures.user.taxes')->with('totalTaxes', $totalTaxes); } public function displayTaxHistory(Request $request) { //Declare new Lookup helper $helper = new LookupHelper(); //Get the months from the request $months = $request->months; //Get the character's corporation from the lookup table or esi $corpId = $helper->LookupCharacter(Auth::user()->character_id); //Declare the structure tax helper class $sHelper = new StructureTaxHelper(); //Get the dates we are working with $dates = $sHelper->GetTimeFrameInMonths($months); //Build the array for displaying the data on the view $totalTaxes = array(); foreach($dates as $date) { $totalTaxes[] = [ 'date' => $date['start']->toFormattedDateString(), 'tax' => number_format($sHelper->GetTaxes($corpId, 'Market', $date['start'], $date['end']), 2, '.', ','), 'revenue' => number_format($sHelper->GetRevenue($corpId, 'Market', $date['start'], $date['end']), 2, '.', ',') ]; } return view('structures.user.taxhistory')->with(compact('totalTaxes', 'months')); } }