コード例 #1
0
 /**
  * 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();
 }
コード例 #2
0
 public function downloadSummary()
 {
     $file = storage_path('app/templates/SpecialLeaveSummary.xlsx');
     $leaves = EmployeeSpecialLeave::certified()->get();
     if ($leaves->isEmpty()) {
         flash()->warning('Special leave empty.');
         return redirect()->back();
     }
     write_form(new \DNSCHumanResource\FormWriters\WriteSpecialLeaveSummary($leaves));
 }