Created Filament Model
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user