49 lines
953 B
PHP
49 lines
953 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use DateTimeInterface;
|
|
|
|
class CollecteException extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = ['date', 'comment', 'magasin_id'];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'date' => 'date',
|
|
];
|
|
|
|
/**
|
|
* Format a date
|
|
*
|
|
* @param DateTimeInterface $date
|
|
* @return string
|
|
*/
|
|
protected function serializeDate(DateTimeInterface $date)
|
|
{
|
|
return $date->format('Y-m-d');
|
|
}
|
|
|
|
/**
|
|
* BelongsTo magasin relation
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function magasin()
|
|
{
|
|
return $this->belongsTo(Magasin::class);
|
|
}
|
|
}
|