ldc-startcoq/app/Models/Ingredient.php
2023-02-23 16:12:54 +01:00

78 lines
1.8 KiB
PHP

<?php
namespace App\Models;
use App\Casts\JsonCast;
use App\Enums\Ingredients\IngredientOriginEnum;
use App\Enums\Ingredients\IngredientFamilyEnum;
use Illuminate\Database\Eloquent\Model;
/**
* @property integer $id
* @property integer $user_id
* @property string $name
* @property string $supplier
* @property boolean $origin
* @property boolean $is_sample
* @property boolean $family
* @property string $packing
* @property string $function
* @property string $observation
* @property string $picture
* @property string $url
* @property string $documents
* @property string $fair
* @property string $created_at
* @property string $updated_at
* @property string $deleted_at
* @property User $user
*/
class Ingredient extends Model
{
/**
* @var array
*/
protected $fillable = [
'user_id',
'name',
'supplier',
'origin',
'is_sample',
'family',
'packing',
'function',
'observation',
'picture',
'url',
'documents',
'fair',
'created_at',
'updated_at',
'deleted_at'
];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'origin' => IngredientOriginEnum::class,
'is_sample' => 'boolean',
'family' => IngredientFamilyEnum::class,
'packing' => JsonCast::class,
'function' => JsonCast::class,
'documents' => JsonCast::class,
'created_at' => 'datetime:Y-m-d',
'updated_at' => 'datetime:Y-m-d',
'deleted_at' => 'datetime:Y-m-d',
];
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo('App\Models\User');
}
}