public function run() { $month = MonthRef::create(['month' => 'January', 'month_code' => '01']); $month = MonthRef::create(['month' => 'February', 'month_code' => '02']); $month = MonthRef::create(['month' => 'March', 'month_code' => '03']); $month = MonthRef::create(['month' => 'April', 'month_code' => '04']); $month = MonthRef::create(['month' => 'May', 'month_code' => '05']); $month = MonthRef::create(['month' => 'June', 'month_code' => '06']); $month = MonthRef::create(['month' => 'July', 'month_code' => '07']); $month = MonthRef::create(['month' => 'August', 'month_code' => '08']); $month = MonthRef::create(['month' => 'September', 'month_code' => '09']); $month = MonthRef::create(['month' => 'October', 'month_code' => '10']); $month = MonthRef::create(['month' => 'November', 'month_code' => '11']); $month = MonthRef::create(['month' => 'December', 'month_code' => '12']); }
public function getMyLeaveCard($id) { $months = MonthRef::all(); //========Query to get the Balance of the User monthly $vac = MonthlyLeaveBalance::where(function ($v) use($id) { //=====To get the Year today $now = Carbon::now(); $yearnow = $now->format('Y'); $v->where('user_id', $id); $v->where('year', $yearnow); })->orderBy('year')->get(); $sick = MonthlyLeaveBalance::where(function ($s) use($id) { //=====To get the Year today $now = Carbon::now(); $yearnow = $now->format('Y'); $s->where('user_id', $id); $s->where('year', $yearnow); })->orderBy('year')->get(); return View::make('my-leave-card')->with('months', $months)->with('vac', $vac); }