сцепление ларавеллы в хранилище - PullRequest
0 голосов
/ 09 декабря 2018

привет, у меня есть консультация имени таблицы с внешним ключом пациента таблицы в моем индексном блейде. Это sajra datatable. Я показываю имя пациента, но я хочу показать имя полного имени (имя и фамилию) в файле репозитория

 public function getForDataTable()
{
    return $this->query()
        ->leftjoin(config('module.patients.table'), config('module.patients.table').'.id', '=', config('module.consultations.table').'.patient_id')
        ->select([
            config('module.consultations.table').'.id',
            config('module.consultations.table').'.patient_id',
            config('module.consultations.table').'.motif',
            config('module.consutations.table').'.date_consultation',
            config('module.consultations.table').'.examen_paraclinique',
            config('module.consultations.table').'.created_at',
            config('module.consultations.table').'.updated_at',
            config('module.patients.table').'.nom_patient as patient_id',
        ]);

}

мой код ajax

 {data: 'patient_id', name: '{{config('module.patients.table')}}.nom_patient'}, 

файл моего ресурса

 'patient_id' =>is_int($this->patient_id) ? optional($this->ownerPat)->nom_patient : $this->patient_id,

спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...