feat: add FeaturedGroup and FeaturedProduct models with migrations for database structure
This commit is contained in:
20
app/Domains/Product/Models/FeaturedGroup.php
Normal file
20
app/Domains/Product/Models/FeaturedGroup.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Product\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class FeaturedGroup extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'tenant_codigo',
|
||||
'group_name',
|
||||
'product_layout',
|
||||
];
|
||||
|
||||
public function featuredProducts(): HasMany
|
||||
{
|
||||
return $this->hasMany(FeaturedProduct::class);
|
||||
}
|
||||
}
|
||||
25
app/Domains/Product/Models/FeaturedProduct.php
Normal file
25
app/Domains/Product/Models/FeaturedProduct.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Product\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class FeaturedProduct extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'featured_group_id',
|
||||
'product_id',
|
||||
'order',
|
||||
];
|
||||
|
||||
public function featuredGroup(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FeaturedGroup::class);
|
||||
}
|
||||
|
||||
public function product(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user