Answer the question
In order to leave comments, you need to log in
Search for tickets, how to make a condition?
Good afternoon.
You need to organize a search for tickets for air flights. Created several test flights in the database with departure dates 04/16/2017 and return 04/29/2017, on the Moscow-Stockholm route (four tickets in total).
If you are looking for a round trip ticket:
The date of departure and date of return are set. Display tickets in pairs, back and forth. If there is no ticket for one of the dates, then output nothing.
If you are looking for a one-way ticket:
It's simple, show the ticket for the date of departure.
In the search model, I made the following search conditions:
$query->andWhere([
'status' => Flights::STATUS_ACTIVE,
'date_start' => [strtotime($this->date_from . ' 00:00'), strtotime($this->date_to . ' 00:00')],
'city_start_id' => [$this->city_from, $this->city_to]
]);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question