Answer the question
In order to leave comments, you need to log in
What is the best way to organize a page with different forms?
There are users with different types in the table (Driver, Passenger, Pedestrian).
There is a Users class with methods
- the create method (users and their type are created here)
- the update method (data about users are updated
) is this correct to implement?
As I see it:
In the update method, accept the id of the updated user, then get the type.
In Switch, get the type and, depending on the type, transfer to render('update') the loading of the _formDriver.php block, and so on.
Answer the question
In order to leave comments, you need to log in
and not easier to make a name for the view with a type id and do just:
$view_name = '_user_view_type_'.$model->type;
return $this->render($view_name,['model'=>$model]);
a little aside
You'd better make 1 more table Profile for example - there will be data about users (names, positions, etc.), in the User table only passwords and logins
https://yiiframework.com.ua/en/doc/guide/2 /input-m...
Well, yes, that's right -- Let ProfileFormService render the desired form, pass it to the
renderer
Everything else can be done through roles in RBAC
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question