Initial import
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
|
||||
/** @var \app\models\UserPublic $user */
|
||||
$user = \app\services\Auth::getUserByToken($_GET['token']);
|
||||
if ($user) {
|
||||
$partner_ids = [];
|
||||
foreach ($user->qrValidators as $qrValidator) {
|
||||
$partner_ids[] = $qrValidator->partner_id;
|
||||
}
|
||||
if (sizeof($partner_ids) > 0) {
|
||||
//$articles->innerJoinWith('events');
|
||||
|
||||
$events = \app\models\Events::find();
|
||||
|
||||
$condition = ['and'];
|
||||
$condition[] = ['=', 'type', 'booking'];
|
||||
$condition[] = ['IN', 'partner_id', $partner_ids];
|
||||
$events->where($condition);
|
||||
$data = [];
|
||||
foreach ($events->all() as $event) {
|
||||
$data[] = [
|
||||
'id' => $event->id,
|
||||
'name' => $event->title(),
|
||||
'date' => date('d.m.Y', strtotime($event->event_dates))];
|
||||
}
|
||||
|
||||
echo json_encode(['data' => $data]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
Reference in New Issue
Block a user