/**
  * Update the specified resource in storage.
  *
  * @param  String  $username
  * @return Response
  */
 public function update($username)
 {
     //check if user exists
     try {
         $employee = $this->user->withTrashed()->whereUsername($username)->firstOrFail();
     } catch (ModelNotFoundException $e) {
         return Redirect::route('profile.edit', ['username' => $username])->with('global-error', 'System error: Saving employee information failed');
     }
     //validate form
     $input = Input::only('first_name', 'middle_name', 'last_name', 'birthdate', 'address', 'email', 'mobile');
     $this->updateProfileForm->validate($input);
     $employee->fill($input)->save();
     return Redirect::back()->with('global-successful', 'Profile information successfully changed!');
 }
 /**
  *
  * Handle the command
  *
  * @param RegisterEmployeeCommand $command
  * @return mixed
  */
 public function handle($command)
 {
     $account = Account::addAccount($command->username, $command->password);
     $employee = Employee::register($command->username, $command->first_name, $command->middle_name, $command->last_name, $command->birthdate, $command->address, $command->email, $command->mobile, $command->department_id);
     $this->accountRepository->save($account);
     $this->employeeRepository->save($employee);
     return $employee;
 }
 /**
  * Return total number of active employees (except system admin)
  *
  * @return int 
  */
 public function activeTotal()
 {
     return Employee::all()->count();
 }