File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Categories/Models/Categorizable.php
<?php declare(strict_types=1);
namespace App\Categories\Models;
use App\Products\AbstractProductable;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* App\Categories\Models\Categorizable
*
* @property int $id
* @property int $category_id
* @property string $categorizable_type
* @property int $categorizable_id
* @property int $sort_order
* @property-read \App\Categories\Models\Category $category
* @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $productable
* @method static \Illuminate\Database\Eloquent\Builder|Categorizable newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Categorizable newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Categorizable query()
* @method static \Illuminate\Database\Eloquent\Builder|Categorizable whereCategorizableId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Categorizable whereCategorizableType($value)
* @method static \Illuminate\Database\Eloquent\Builder|Categorizable whereCategoryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Categorizable whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Categorizable whereSortOrder($value)
* @mixin \Eloquent
*/
class Categorizable extends Pivot
{
protected $table = 'categorizables';
/**
* @return BelongsTo
*/
public function category(): BelongsTo {
return $this->belongsTo(Category::class);
}
/**
* Resolves to a Productable
*
* @see AbstractProductable
* @return MorphTo
*/
public function productable(): MorphTo {
return $this->morphTo(null, 'categorizable_type', 'categorizable_id');
}
}