2023-02-22 11:51:36 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2023-06-21 10:24:56 +00:00
|
|
|
use App\Enums\Ingredients\OriginEnum;
|
|
|
|
|
use App\Enums\Ingredients\FamilyEnum;
|
2023-02-23 16:23:00 +01:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
2023-02-22 11:51:36 +01:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @property integer $id
|
|
|
|
|
* @property integer $user_id
|
|
|
|
|
* @property string $name
|
|
|
|
|
* @property string $supplier
|
2023-06-21 10:24:56 +00:00
|
|
|
* @property enum $origin
|
2023-02-22 11:51:36 +01:00
|
|
|
* @property boolean $is_sample
|
2023-06-21 10:24:56 +00:00
|
|
|
* @property enum $family
|
2023-02-22 11:51:36 +01:00
|
|
|
* @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
|
|
|
|
|
{
|
2023-02-23 16:23:00 +01:00
|
|
|
use HasFactory;
|
|
|
|
|
|
2023-02-22 11:51:36 +01:00
|
|
|
/**
|
|
|
|
|
* @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 = [
|
2023-06-21 10:24:56 +00:00
|
|
|
'origin' => OriginEnum::class,
|
2023-02-22 11:51:36 +01:00
|
|
|
'is_sample' => 'boolean',
|
2023-06-21 10:24:56 +00:00
|
|
|
'family' => FamilyEnum::class,
|
2023-02-23 16:23:00 +01:00
|
|
|
'packing' => 'json',
|
|
|
|
|
'function' => 'json',
|
|
|
|
|
'documents' => 'json',
|
2023-02-22 11:51:36 +01:00
|
|
|
'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');
|
|
|
|
|
}
|
|
|
|
|
}
|