C
C
criminalist2020-01-16 11:59:58
Yii
criminalist, 2020-01-16 11:59:58

How to select by dates?

Hello, I can’t master the selection by date, in general I don’t understand how it should work.
Given a YII2 based API, controllers and models, the URL is set up like this.
https://api.site.ru/v1/:users
In general, I just started working with data, getting, writing and editing everything works, but I can’t understand how to get data by start date and of course date, through the URL, if not difficult simple examples can anyone show.
In examples from the network, such options slip through,

public function search($params)
    {
        $query->andFilterWhere(['like', 'timestamp', $this->dateBegin]);

Well, let's say I make a method how to access it and pass parameters, in our case the dates themselves?
and if we type /v1/users/?expand=name in the browser,
we will get related data from another table or model in any way, but I can’t figure it out with other methods.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question