2020-12-01 17:02:10 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
2023-09-06 17:24:53 +02:00
|
|
|
/**
|
|
|
|
|
* @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.
|
|
|
|
|
*/
|
2020-12-01 17:02:10 +01:00
|
|
|
class ServiceStat extends Model
|
|
|
|
|
{
|
|
|
|
|
use HasFactory;
|
|
|
|
|
|
2021-12-19 15:57:24 +01:00
|
|
|
/**
|
|
|
|
|
* The attributes that are mass assignable.
|
|
|
|
|
*
|
2025-07-24 11:32:12 +02:00
|
|
|
* @var array<int, string>
|
2021-12-19 15:57:24 +01:00
|
|
|
*/
|
2023-09-04 13:08:34 +02:00
|
|
|
protected $fillable = [
|
|
|
|
|
'date',
|
|
|
|
|
];
|
2020-12-01 17:02:10 +01:00
|
|
|
|
2021-12-19 15:57:24 +01:00
|
|
|
/**
|
|
|
|
|
* The model's attributes.
|
|
|
|
|
*
|
2025-07-24 11:32:12 +02:00
|
|
|
* @var array<string, mixed>
|
2021-12-19 15:57:24 +01:00
|
|
|
*/
|
2021-03-14 10:45:42 +01:00
|
|
|
protected $attributes = [
|
2023-09-04 13:08:34 +02:00
|
|
|
'nb_calls' => 0,
|
2021-03-14 10:45:42 +01:00
|
|
|
];
|
|
|
|
|
|
2023-09-06 17:24:53 +02:00
|
|
|
/**
|
|
|
|
|
* Map attribute names to enum classes.
|
|
|
|
|
*
|
2025-07-24 11:32:12 +02:00
|
|
|
* @var array<string, mixed>
|
2023-09-06 17:24:53 +02:00
|
|
|
*/
|
|
|
|
|
protected $casts = [
|
|
|
|
|
'date' => 'date',
|
|
|
|
|
];
|
|
|
|
|
|
2021-12-19 15:57:24 +01:00
|
|
|
// * RELATIONS
|
|
|
|
|
|
2021-02-28 12:04:49 +01:00
|
|
|
/**
|
2025-07-24 11:32:12 +02:00
|
|
|
* Brand belongs to relation.
|
2021-02-28 12:04:49 +01:00
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
|
*/
|
2023-09-06 17:24:53 +02:00
|
|
|
public function brand(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
2021-02-28 12:04:49 +01:00
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Brand::class);
|
2020-12-01 17:02:10 +01:00
|
|
|
}
|
|
|
|
|
|
2021-02-28 12:04:49 +01:00
|
|
|
/**
|
2025-07-24 11:32:12 +02:00
|
|
|
* Service belongs to relation.
|
2021-02-28 12:04:49 +01:00
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
|
*/
|
2023-09-06 17:24:53 +02:00
|
|
|
public function service(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
2021-02-28 12:04:49 +01:00
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Service::class);
|
2020-12-01 17:02:10 +01:00
|
|
|
}
|
|
|
|
|
}
|