How to pass parameters in with for example I have a function four params $logId,$categoryId,$empId,$depId
Now I want to pass $empId and $depId in with function getUserAssHisCustomize
public static function getHisDataCustomize($logId, $categoryId,$empId,$depId) {
return self::where('assessment_log_id', $logId)
->where('category_id', $categoryId)
->with('getUserAssHisCustomize')
->first();
}
something like this getUserAssHisCustomize($empId,$depId)
then pass these two params in another with used in below function.
public function getUserAssHisCustomize() {
return $this->hasMany('\App\UserAssessmentAnswerHistory', 'assessment_history_id', 'id')
->orderBy('sub_category_id', 'ASC')
->with('getCatNameCustomize');
}
like this getCatNameCustomize($empId,$depId) then I an to use these two params in where in third function shown below
public function getCatNameCustomize() {
return $this->hasOne('\App\CustomizeNormSubcategoryDetail', 'assessment_category_id', 'sub_category_id')
->where('employer_id',$empId)
->where('department_id',$depId);
}
I have checked many links n stack overflow but didnt find any answer related to this Laravel 5.1 Eager Loading - belongsToMany with parameter
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire