Exemplo n.º 1
0
 /**
  * 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!');
 }
Exemplo n.º 2
0
 /**
  * Get all employees beside with position of system admin including softdeleted, to be ordered according to the date deleted
  *
  * @return Employee
  */
 public function getRegisteredEmployees()
 {
     return Employee::withTrashed()->where('position', '<', 2)->orderBy('deleted_at', 'ASC');
     //exclude system administrator
 }