/** * Render yearly panel with navigation and chart * @param string $envelopeId Envelope primary key * @param string|null $date Date within the year to consider (default to current year) * @return Illuminate\View\View|\Illuminate\Contracts\View\Factory View */ public function getYearly($envelopeId, $date = null) { $envelope = Auth::user()->envelopes()->findOrFail($envelopeId); $date = is_null($date) ? Carbon::today() : Carbon::createFromFormat('Y-m-d', $date); $data = ['envelope' => $envelope, 'date' => $date, 'prevYear' => $date->copy()->subYear(), 'nextYear' => $date->copy()->addYear(), 'chart' => LineChart::forge($envelope, $date, LineChart::PERIOD_YEAR)]; return view('envelope.development.yearly', $data); }
/** * Render envelopes panel with navigation and chart * @param string $accountId Account primary key * @param string|null $date Date within the year to consider (default to current year) * @return Illuminate\View\View|\Illuminate\Contracts\View\Factory View */ public function getEnvelopes($accountId, $date = null) { $account = Auth::user()->accounts()->findOrFail($accountId); $date = is_null($date) ? Carbon::today() : Carbon::createFromFormat('Y-m-d', $date); $data = ['account' => $account, 'date' => $date, 'prevYear' => $date->copy()->subYear(), 'nextYear' => $date->copy()->addYear(), 'chart' => LineChart::forge($account->envelopes, $date, LineChart::PERIOD_YEAR)]; return view('account.development.envelopes', $data); }