93 lines
3.4 KiB
PHP
93 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\Models\IsCachedAsCollection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Settings.
|
|
*
|
|
* @property string $name The game name
|
|
* @property string $company Name of the company that organizes the game
|
|
* @property \Illuminate\Support\Carbon $start_date Start date of the game
|
|
* @property \Illuminate\Support\Carbon $end_date End date of the game
|
|
* @property int $nb_participation_player Max paticipation per player
|
|
* @property int $nb_participation_ip Max paticipation per ip
|
|
* @property int $nb_unique_code_use Max unique code use
|
|
* @property boolean $use_ean_codes Should the game use ean codes ?
|
|
* @property boolean $activated_teaser Is the teaser active ?
|
|
* @property boolean $activated_close_page Is the close page active ?
|
|
* @property \Illuminate\Support\Carbon $close_page_active_date End date of the close page
|
|
* @property string $redirect_close Link to redirect when the game is ended
|
|
* @property boolean $reductions_activated Are the reductions active ?
|
|
* @property string $reductions_site Reduction site
|
|
* @property string $reductions_campaign Reduction campaign
|
|
* @property string $web_coupons Array of web coupons
|
|
* @property array<string> $notification_emails Array of email to notify when there's a winnner
|
|
* @property boolean $winning_proof Is the winning proof needed
|
|
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
|
|
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
|
|
*/
|
|
class Settings extends Model
|
|
{
|
|
use IsCachedAsCollection;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'company',
|
|
'start_date',
|
|
'end_date',
|
|
'nb_participation_player',
|
|
'nb_participation_ip',
|
|
'nb_unique_code_use',
|
|
'use_ean_codes',
|
|
'activated_teaser',
|
|
'activated_close_page',
|
|
'close_page_active_date',
|
|
'redirect_close',
|
|
'reductions_activated',
|
|
'reductions_site',
|
|
'reductions_campaign',
|
|
'web_coupons',
|
|
'notification_emails',
|
|
'winning_proof',
|
|
'analytics',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'start_date' => 'datetime',
|
|
'end_date' => 'datetime',
|
|
'close_page_active_date' => 'datetime',
|
|
'web_coupons' => 'array',
|
|
'notification_emails' => 'array',
|
|
];
|
|
|
|
/**
|
|
* Perform any actions required after the model boots.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected static function booted()
|
|
{
|
|
static::created(function () {
|
|
self::removeCached();
|
|
});
|
|
static::updated(function () {
|
|
self::removeCached();
|
|
});
|
|
static::deleted(function () {
|
|
self::removeCached();
|
|
});
|
|
}
|
|
}
|