Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ServiceStat | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| brand | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| service | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Models; |
| 4 | |
| 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 6 | use Illuminate\Database\Eloquent\Model; |
| 7 | |
| 8 | /** |
| 9 | * @property integer $id Id. |
| 10 | * @property integer $brand_id Foreign key Brand. |
| 11 | * @property integer $service_id Foreign key Service. |
| 12 | * @property \Illuminate\Support\Carbon $date Date. |
| 13 | * @property integer $nb_calls Nombre d'appels. |
| 14 | * @property-read \Illuminate\Support\Carbon $created_at Created date. |
| 15 | * @property-read \Illuminate\Support\Carbon $updated_at Updated date. |
| 16 | * |
| 17 | * @property-read \App\Models\Brand $brand Brand BelongsTo relation. |
| 18 | * @property-read \App\Models\Service $service Service BelongsTo relation. |
| 19 | */ |
| 20 | class ServiceStat extends Model |
| 21 | { |
| 22 | use HasFactory; |
| 23 | |
| 24 | /** |
| 25 | * The attributes that are mass assignable. |
| 26 | * |
| 27 | * @var string[] |
| 28 | */ |
| 29 | protected $fillable = [ |
| 30 | 'date', |
| 31 | ]; |
| 32 | |
| 33 | /** |
| 34 | * The model's attributes. |
| 35 | * |
| 36 | * @var array |
| 37 | */ |
| 38 | protected $attributes = [ |
| 39 | 'nb_calls' => 0, |
| 40 | ]; |
| 41 | |
| 42 | /** |
| 43 | * Map attribute names to enum classes. |
| 44 | * |
| 45 | * @var array |
| 46 | */ |
| 47 | protected $casts = [ |
| 48 | 'date' => 'date', |
| 49 | ]; |
| 50 | |
| 51 | // * RELATIONS |
| 52 | |
| 53 | /** |
| 54 | * Brand BelongsTo relation. |
| 55 | * |
| 56 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
| 57 | */ |
| 58 | public function brand(): \Illuminate\Database\Eloquent\Relations\BelongsTo |
| 59 | { |
| 60 | return $this->belongsTo(Brand::class); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Service BelongsTo relation. |
| 65 | * |
| 66 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
| 67 | */ |
| 68 | public function service(): \Illuminate\Database\Eloquent\Relations\BelongsTo |
| 69 | { |
| 70 | return $this->belongsTo(Service::class); |
| 71 | } |
| 72 | } |