Skip to content

Commit

Permalink
refactor: add get users function
Browse files Browse the repository at this point in the history
  • Loading branch information
im-machakata committed Apr 1, 2024
1 parent a7da9b1 commit 569ac93
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/Models/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,16 @@ class Account extends Model
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];

/**
* Returns an array of employees and their departments 6 at a time
*
* @return array|null
*/
public function getUsers()
{
return $this->join('employees', 'AccountID = accounts.ID')
->join('departments', 'DepartmentID = departments.ID')
->paginate(6);
}
}

0 comments on commit 569ac93

Please sign in to comment.