Files
generic_table_examples/app/Models/Product.php
David 25c6b316bd #FEAT
+ Added new example about the new feature: custom column
2025-03-17 22:33:11 -04:00

29 lines
654 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
class Product extends Model
{
use HasFactory;
protected $fillable = [
'name', 'description', 'price', 'stock', 'category', 'brand',
'sku', 'weight', 'status', 'order'
];
public function subDepartment() : BelongsTo
{
return $this->belongsTo(SubDepartment::class);
}
public function settings() : HasOne
{
return $this->hasOne(ProductSetting::class);
}
}