Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1.   public function getGrade()
  2.   {
  3.     return $this->hasOne(Grade::class, ['id' => 'value'])
  4.       ->viaTable('employee_diffs', ['employee_id' => 'id'], function ($query)
  5.       {
  6.         return $query->andWhere(['employee_diffs.diff_type' => Diff::DIFF_TYPE_SALARY_GRADE_CATEGORY]);
  7.       });
  8.   }
  9.  
  10.   public function getDepartment()
  11.   {
  12.     return $this->hasOne(Department::class, ['id' => 'department_id'])->via('grade');
  13.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement