ldc-boutique-cnc/app/Models/CollectionException.php

52 lines
946 B
PHP
Raw Permalink Normal View History

2021-04-21 16:48:37 +02:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use DateTimeInterface;
2022-10-03 17:13:44 +02:00
class CollectionException extends Model
2021-04-21 16:48:37 +02:00
{
use HasFactory;
2022-09-03 16:56:16 +02:00
/**
* The attributes that are mass assignable.
*
* @var array
*/
2022-10-03 17:13:44 +02:00
protected $fillable = [
'date', 'shop_id'
];
2021-04-21 16:48:37 +02:00
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'date' => 'date',
];
2022-09-03 16:56:16 +02:00
/**
* Format a date
*
* @param DateTimeInterface $date
* @return string
*/
2021-04-21 16:48:37 +02:00
protected function serializeDate(DateTimeInterface $date)
{
return $date->format('Y-m-d');
}
2022-09-03 16:56:16 +02:00
/**
2022-10-03 17:13:44 +02:00
* BelongsTo shop relation
2022-09-03 16:56:16 +02:00
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
2022-10-03 17:13:44 +02:00
public function shop()
{
2022-10-03 17:13:44 +02:00
return $this->belongsTo(Shop::class);
}
2021-04-21 16:48:37 +02:00
}