72 lines
1.8 KiB
PHP
72 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* @property integer $id Id.
|
|
* @property integer $brand_id Foreign key Brand.
|
|
* @property integer $service_id Foreign key Service.
|
|
* @property \Illuminate\Support\Carbon $date Date.
|
|
* @property integer $nb_calls Nombre d'appels.
|
|
* @property-read \Illuminate\Support\Carbon $created_at Created date.
|
|
* @property-read \Illuminate\Support\Carbon $updated_at Updated date.
|
|
*
|
|
* @property-read \App\Models\Brand $brand Brand BelongsTo relation.
|
|
* @property-read \App\Models\Service $service Service BelongsTo relation.
|
|
*/
|
|
class ServiceStat extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $fillable = [
|
|
'date',
|
|
];
|
|
|
|
/**
|
|
* The model's attributes.
|
|
*
|
|
* @var array<string, mixed>
|
|
*/
|
|
protected $attributes = [
|
|
'nb_calls' => 0,
|
|
];
|
|
|
|
/**
|
|
* Map attribute names to enum classes.
|
|
*
|
|
* @var array<string, mixed>
|
|
*/
|
|
protected $casts = [
|
|
'date' => 'date',
|
|
];
|
|
|
|
// * RELATIONS
|
|
|
|
/**
|
|
* Brand belongs to relation.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function brand(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
{
|
|
return $this->belongsTo(Brand::class);
|
|
}
|
|
|
|
/**
|
|
* Service belongs to relation.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function service(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
{
|
|
return $this->belongsTo(Service::class);
|
|
}
|
|
}
|