A
A
atis //2016-07-21 11:09:26
Yii
atis //, 2016-07-21 11:09:26

Where should cookies and sessions be written in Yii2, in the model or in the controller?

Hello.
There is a model for authorization. It will set up the data in the cookie and session.
It is right?
After all, the model must receive data from the controller. If you take out the session processing in the controller, you get code duplication.
Since the controllers for authorization - outputs are different.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2016-07-21
@atis2345

There is a model for authorization. It will set up the data in the cookie and session.
It is right?

Why not?

N
Ne-Lexa, 2016-07-22
@NeLexa

Yii2 has models for forms. In the example (application template), this is where authorization cookies are set, through the User component.
I don't see anything wrong with that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question