コード例 #1
0
 /**
  * resend activation link
  *
  * 1. resend activation link
  * @param employee id
  * @return array of employee
  */
 public function resendActivationLink($id)
 {
     //1. get activation link
     $employee = Employee::id($id)->first();
     if (!$employee) {
         return new JSend('error', Input::all(), ['Akun tidak valid']);
     }
     $employee = $employee->toArray();
     if (empty($employee['email'])) {
         return new JSend('error', Input::all(), ['Belum ada alamat email karyawan']);
     }
     Event::fire(new EmployeeCreated($employee));
     return new JSend('success', ['employee' => $employee]);
 }
コード例 #2
0
 /**
  * auto generate username
  *
  * 1. check existance
  * 2. get firstname
  * @param code and employee name
  * @return $username
  */
 public function generateUsername($code, $id = 0)
 {
     //1. check existance
     $uname = Employee::id($id)->first();
     if ($uname && !empty($uname['username'])) {
         return new JSend('success', ['username' => $uname['username']]);
     }
     //2. get firstname
     if (!Input::has('name')) {
         return new JSend('error', (array) Input::all(), 'No Name');
     }
     $name = Input::get('name');
     $username = UsernameGenerator::generate($code, $id, $name);
     return new JSend('success', ['username' => $username]);
 }
コード例 #3
0
 /**
  * Delete an Schdule
  *
  * @return Response
  */
 public function delete($org_id = null, $emp_id = null, $id = null)
 {
     //check branch
     $schedule = \App\ThunderID\EmploymentSystemV1\Models\Employee::id($emp_id)->organisationid($org_id)->first();
     if (!$schedule) {
         \App::abort(404);
     }
     $schedule = \App\ThunderID\WorkforceManagementV1\Models\PersonSchedule::personid($emp_id)->id($id)->first();
     if (!$schedule) {
         return new JSend('error', (array) Input::all(), 'Schdule tidak ditemukan.');
     }
     $result = $schedule->toArray();
     if ($schedule->delete()) {
         return new JSend('success', (array) $result);
     }
     return new JSend('error', (array) $result, $schedule->getError());
 }
コード例 #4
0
 /**
  * Delete an employee
  *
  * @return Response
  */
 public function delete($org_id = null, $id = null)
 {
     //
     $employee = \App\ThunderID\EmploymentSystemV1\Models\Employee::id($id)->organisationid($org_id)->currentgrade(true)->currentmaritalstatus(true)->with(['persondocuments', 'maritalstatuses', 'relatives', 'relatives.relative', 'contacts', 'works', 'works.contractworks', 'works.contractworks.contractelement'])->first();
     if (!$employee) {
         return new JSend('error', (array) Input::all(), 'Karyawan tidak ditemukan.');
     }
     $result = $employee->toArray();
     if ($employee->delete()) {
         return new JSend('success', (array) $result);
     }
     return new JSend('error', (array) $result, $employee->getError());
 }