public function downloadSummary() { $leaves = EmployeeLeave::certified()->get(); if ($leaves->isEmpty()) { flash()->warning('No regular leave filed.'); return redirect()->back(); } write_form(new WriteRegularLeaveSummary($leaves)); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { if ($this->user->isAdmin()) { $regular_leaves = EmployeeLeave::certified()->orderBy('updated_at', 'desc')->get(); $special_leaves = EmployeeSpecialLeave::certified()->orderBy('updated_at', 'desc')->get(); return view('leaves.approved_leaves')->with(compact('regular_leaves', 'special_leaves')); } flash()->error('You are not allowed to view this.'); return redirect()->back(); }