Files
FilamentLaravel/app/Models/Filament.php
T
2025-03-10 19:37:59 +01:00

42 lines
765 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Filament extends Model
{
// Filament Model
protected $table = 'filaments';
protected $primaryKey = 'id';
protected $fillable = [
'name',
'type_id',
'manufacturer_id',
'color_id',
'weight',
'diameter',
'price',
];
// Filament belongs to a type
public function type()
{
return $this->belongsTo(FilamentType::class);
}
// Filament belongs to a manufacturer
public function manufacturer()
{
return $this->belongsTo(Manufacturer::class);
}
// Filament belongs to a color
public function color()
{
return $this->belongsTo(Color::class);
}
}