43 lines
788 B
PHP
43 lines
788 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',
|
|
'description',
|
|
'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);
|
|
}
|
|
|
|
}
|