bebeboutik-api/app/Models/Carrier.php
Christophe LATOUR c88ea57ba5 Initial commit
2017-07-21 16:40:11 +02:00

36 lines
747 B
PHP

<?php
namespace App\Models;
use Antadis\API\Front\Models\Carrier as BaseCarrier;
/**
* @rest\model Carrier
* @rest\property inetger is_relay
*/
class Carrier extends BaseCarrier
{
protected $_relayConfiguration = NULL;
/**
* Returns carrier_ids which are relay
* @return type
*/
protected function getRelayConfiguration() {
if ($this->_relayConfiguration === NULL) {
$this->_relayConfiguration = \Configuration::get('ANT_CARRIERS_OOH');
}
return $this->_relayConfiguration;
}
/**
* {@inheritdoc}
*/
public function toArray() {
$relayConfiguration = $this->getRelayConfiguration();
return array_merge(parent::toArray(), array(
'is_relay' => in_array($this->id, explode(',', $relayConfiguration))
));
}
}