Initial commit: apps.supersam24.ru
This commit is contained in:
commit
e955e1da36
6566 files changed
+1271095
No files matched your search
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use Cake\Event\Event;
|
||||
use Cake\ORM\TableRegistry;
|
||||
|
||||
class DeliveryController extends AppController {
|
||||
public function beforeFilter(Event $event)
|
||||
{
|
||||
parent::beforeFilter($event);
|
||||
// $this->Auth->allow(['display']);
|
||||
$this->viewBuilder()->setLayout('delivery');
|
||||
}
|
||||
|
||||
|
||||
public function display($city = null) {
|
||||
$isCityFound = false;
|
||||
if (!empty($city)) {
|
||||
$deliveryTable = TableRegistry::getTableLocator()->get('Delivery');
|
||||
|
||||
$delivery = $deliveryTable->find('all')->where(['slug' => $city, 'is_deleted' => false])->first();
|
||||
if (!empty($delivery)) {
|
||||
$delivery = $delivery->toArray();
|
||||
|
||||
$this->set('apiKey', $this->config['global']['yandexMapApiKey']['value']);
|
||||
$this->set('siteTitle', $delivery['label']);
|
||||
$this->set('delivery', $delivery);
|
||||
$isCityFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($isCityFound)) {
|
||||
$this->redirect('/404');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user