2019-02-20 16:26:32 +01:00
|
|
|
<?php
|
|
|
|
|
|
2025-11-12 16:35:16 +01:00
|
|
|
namespace App\Models;
|
2019-02-20 16:26:32 +01:00
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
class Statistique extends Model
|
|
|
|
|
{
|
2019-02-27 16:36:53 +01:00
|
|
|
public $timestamps = false;
|
2021-04-27 17:29:47 +02:00
|
|
|
|
2019-02-20 16:26:32 +01:00
|
|
|
/**
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $table = 'statistiques';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $primaryKey = 'id';
|
|
|
|
|
/**
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2019-02-27 16:36:53 +01:00
|
|
|
const CREATED_AT = 'created_at';
|
2019-02-20 16:26:32 +01:00
|
|
|
|
2025-11-07 10:56:09 +01:00
|
|
|
/**
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $fillable = [
|
2019-02-20 16:26:32 +01:00
|
|
|
'stat_campId',
|
|
|
|
|
'stat_couponId',
|
2025-11-04 15:29:03 +01:00
|
|
|
'stat_couponPrinted',
|
|
|
|
|
'date'
|
2019-02-20 16:26:32 +01:00
|
|
|
];
|
2025-11-04 15:29:03 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
2025-11-07 10:56:09 +01:00
|
|
|
protected $casts = [
|
|
|
|
|
'date' => 'date'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Perform any actions required after the model boots.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
protected static function booted(): void
|
|
|
|
|
{
|
|
|
|
|
static::creating(function (self $model) {
|
|
|
|
|
$model->date = now()->toDateString();
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-11-04 15:29:03 +01:00
|
|
|
|
|
|
|
|
// * RELATIONS
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ArchiveCoupon model relation
|
|
|
|
|
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
|
*/
|
|
|
|
|
public function campaign()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Campagne::class, 'stat_campId', 'camp_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ArchiveCampaign model relation
|
|
|
|
|
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
|
*/
|
|
|
|
|
public function coupon()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Coupon::class, 'stat_couponId', 'coupon_id');
|
|
|
|
|
}
|
2019-02-20 16:26:32 +01:00
|
|
|
}
|