public static function createLeaveType($data) { $organization = Organization::getUserOrganization(); $leavetype = new Leavetype(); $leavetype->name = array_get($data, 'name'); $leavetype->days = array_get($data, 'days'); $leavetype->organization()->associate($organization); $leavetype->save(); }
public static function createHoliday($data) { $organization = Organization::getUserOrganization(); $holiday = new Holiday(); $holiday->name = array_get($data, 'name'); $holiday->date = array_get($data, 'date'); $holiday->organization()->associate($organization); $holiday->save(); }
public static function createLeaveApplication($data) { $organization = Organization::getUserOrganization(); $employee = Employee::find(array_get($data, 'employee_id')); $leavetype = Leavetype::find(array_get($data, 'leavetype_id')); $application = new Leaveapplication(); $application->applied_start_date = array_get($data, 'applied_start_date'); $application->applied_end_date = array_get($data, 'applied_end_date'); $application->status = 'applied'; $application->application_date = date('Y-m-d'); $application->employee()->associate($employee); $application->leavetype()->associate($leavetype); $application->organization()->associate($organization); $application->save(); }