Christophe LATOUR dbe268c561 Handling images
2017-08-14 12:39:19 +02:00

20 lines
444 B
PHP

<?php
namespace App\Models;
use Antadis\API\Front\Models\Sale as BaseSale;
use App\Classes\ImageTrait;
class Sale extends BaseSale {
use ImageTrait;
/**
* {@inheritdoc}
*/
public function toArray() {
$sale = parent::toArray();
$is_active = strtotime($this->date_start) < strtotime(date('Y-m-d 07:00:00'));
$sale['img'] = $this->getSaleImage($this->id, $is_active);
return $sale;
}
}