ECOMMERCE/app/Models/AffiliatorItemCode.php

41 lines
774 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AffiliatorItemCode extends Model
{
use HasFactory;
protected $table = 'affiliator_item_codes';
protected $primaryKey = 'id';
public $incrementing = true;
protected $keyType = 'int';
protected $fillable = [
'code',
'codeable_id',
'codeable_type',
'affiliator_item_id',
'affiliator_id',
];
public function affiliator()
{
return $this->belongsTo(Affiliator::class);
}
public function affiliatorItem()
{
return $this->belongsTo(AffiliatorItem::class);
}
public function codeable()
{
return $this->morphTo();
}
}