/** * Display a listing of the resource. * * @return Response */ public function index($teammate) { $teammate = Teammate::find($teammate); $teammate->employment_months = employment_months($teammate->date_of_joining); $types = leave_types(); return view('leaves.index', compact('teammate', 'types')); }
public function getEarnedAttribute() { return employment_months($this->date_of_joining) * round($this->no_of_leaves / 12, 2); }