Answer the question
In order to leave comments, you need to log in
How to return a custom relation of a model via ajax?
The user table has fields Last name First name Middle name
The model has the getInitials() function:
public function getInitials()
{
return $this->surname . ' ' . mb_substr($this->name, 0, 1, 'UTF-8') . '.' . mb_substr($this->patronymic, 0, 1, 'UTF-8') . '.';
}
Answer the question
In order to leave comments, you need to log in
On the server, the model is easily passed between functions and $model->initials can be called everywhere, but when using ajax, this relationship disappears.
but when using ajax this relationship disappears
$model->initials
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question