public function index()
 {
     $today = Carbon::today();
     if ($today->day < 15) {
         $inicio = $today->firstOfMonth();
         $futuro = $inicio->addDays(14);
     } else {
         $futuro = $today->lastOfMonth();
     }
     $noticias = Noticia::where('fin', $futuro)->get();
     $tareas = Labor::where('fin', $futuro)->get();
     $user = Auth::user();
     $recursos = Recurso::all();
     //$becario = DB::table('becarios')->where('user_id',$user->id)->first();
     return view('Becario/index', compact('user', 'recursos', 'noticias', 'tareas'));
 }
Пример #2
0
 /**
  * View employees with loan
  *
  * @param  int  $id
  * @return Response
  */
 public function storeLoan(AddLoanRequest $request, $id)
 {
     $interval = intval($request->input('interval'));
     $noOfMonths = intval($request->input('months-to-pay'));
     $labor = Labor::where('employee_no', $id)->first();
     $loanEntry = $labor->loan()->save(new Loan($request->all()));
     $loanEntry->deduction = intval($request->input('amount')) / $noOfMonths;
     $loanEntry->save();
     $loanId = $loanEntry->id;
     $start_date = Carbon::parse($request->input('starting_date'));
     //dd($noOfMonths);
     for ($noOfMonths, $start_date; $noOfMonths > 0; $noOfMonths--, $start_date->addMonth($interval)) {
         $loan = new LoanMonths();
         $loan->deduction_date = $start_date;
         $loan->loan_id = $loanId;
         $loan->save();
     }
     flash()->success('Loan successfully added.');
     return redirect('employees/' . $id . '/edit');
 }
Пример #3
0
 /**
  * Add Attendance to labor
  *
  * @return Response
  */
 public function addAttendance($id)
 {
     $labor = Labor::where('employee_no', '=', $id)->first();
     $holiday = $this->todayIsHoliday();
     //dd($labor);
     return view('pages.add_attendance', compact('labor', 'holiday'));
 }