ldc-flucollector/app/Models/XmlInco.php
Jérémy Munsch 656120f042
TMP
- Arcadia Xml Jobs WIP
- Api WIP
2022-04-11 12:41:44 +02:00

79 lines
1.4 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
/**
* XmlInco
*
* pictures attribute is organized as following
* [
* 'checksum' => 'storageFilePath'
* ]
*
* ! checksum includes fullfilepath + data
*/
class XmlInco extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'id',
'no_art',
'prod_saison',
'allegations',
'conseil_prepa',
'astuces',
'descriptif',
'arg_vente',
'nb_portion',
'typ_portion',
'pds_moy_theo',
'lib_conso',
'lst_ing',
'lib_allergene',
'nutritional_values',
'pictures',
];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'pictures' => 'array',
'nutritional_values' => 'array',
];
// * GETTERS
/**
* Get niceString attribute
*
* @return string
*/
public function getNiceStringAttribute(): string
{
return sprintf('%s - %s', $this->id, $this->descriptif);
}
// * RELATIONS
/**
* ArcadiaBrand belongsTo relation
*
* @return \Illuminate\Database\Eloquent\Relations\belongsTo
*/
public function arcadiaBrand()
{
return $this->belongsTo(ArcadiaBrand::class);
}
}