Files
FilamentLaravel/app/Models/Filament.php
T

50 lines
956 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',
'filament_type_id',
'manufacturer_id',
'color_id',
'weight',
'diameter',
'price',
'finish',
'image',
'stock',
'temp_min',
'temp_max',
'buildplate_id',
'extruder_id'
];
// Filament belongs to a type
public function type()
{
return $this->belongsTo(FilamentType::class, 'filament_type_id');
}
// 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);
}
}