Created Color Model
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Color extends Model
|
||||||
|
{
|
||||||
|
// Color Model
|
||||||
|
protected $table = 'colors';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'hex'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Color has many filaments
|
||||||
|
public function filaments()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Filament::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Color has many filament types
|
||||||
|
public function filamentTypes()
|
||||||
|
{
|
||||||
|
return $this->hasMany(FilamentType::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user