Answer the question
In order to leave comments, you need to log in
How to pass id to model functions?
Is it possible to pass id in the model somehow? or not. For example, in the controller, passing id to the getter is acceptable and, accordingly, it happened without errors. I get this error Calling unknown method: app\models\Notification::byIdUser()
Here is the model
public function getByIdUser($id)
{
$zakaz = new Zakaz();
$notification->id_user = $id;
$notification->name = 'Доставка '.$model->description;
$notification->id_zakaz = $zakaz->id_zakaz;
}
$notification->byIdUser(7);
$notification->byIdUser(7);
Answer the question
In order to leave comments, you need to log in
If it is the id of the current user, that is:
But your function returns nothing. It is basically meaningless.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question