Refactor Brand, Category, Product, and ModelPropValue models to remove morph relationships; update migration files for props and model prop values to reflect new foreign key structure.
This commit is contained in:
@@ -2,14 +2,11 @@
|
||||
|
||||
namespace App\Domains\Product\Models;
|
||||
|
||||
use App\Domains\Prop\Models\ModelPropValue;
|
||||
use App\Domains\Prop\Models\Prop;
|
||||
use App\Domains\Tenant\Models\Tenant;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
|
||||
#[Fillable([
|
||||
'tenant_codigo',
|
||||
@@ -40,20 +37,4 @@ class Product extends Model
|
||||
{
|
||||
return $this->belongsTo(Tenant::class, 'tenant_codigo', 'codigo');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany<Prop, $this>
|
||||
*/
|
||||
public function props(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Prop::class, 'propable');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany<ModelPropValue, $this>
|
||||
*/
|
||||
public function propValues(): MorphMany
|
||||
{
|
||||
return $this->morphMany(ModelPropValue::class, 'valuable');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user