V
V
Vladimir2016-12-04 11:58:06
Yii
Vladimir, 2016-12-04 11:58:06

How to correctly form the URL in the controller?

Good afternoon!
It is necessary to make a substitution of the url in the controller, I do it like this and everything works, but in my opinion, the crutch is still the same, how to do it beautifully and correctly?
$event->url = ['view?id='.$appointment->id];

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2016-12-04
@ipdesign

Good morning.
I would use helpers\Url;
More details with lots of examples

V
Vladimir, 2016-12-04
@ipdesign

Thanks to!
In my case it turned out like this:

$event->url = Url::toRoute(['view', 'id' => $appointment->id]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question