Files
animethemes-server/app/Models/Aggregate/ViewAggregate.php
T
2025-10-01 17:18:31 -03:00

51 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Models\Aggregate;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
/**
* @property Model $viewable
* @property string $viewable_type
* @property int $viewable_id
* @property int $value
*/
class ViewAggregate extends Model
{
final public const string TABLE = 'view_aggregates';
final public const string ATTRIBUTE_VIEWABLE = 'viewable';
final public const string ATTRIBUTE_VIEWABLE_TYPE = 'viewable_type';
final public const string ATTRIBUTE_VIEWABLE_ID = 'viewable_id';
final public const string ATTRIBUTE_VALUE = 'value';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = ViewAggregate::TABLE;
/**
* Indicates if the IDs are auto-incrementing.
*
* @var bool
*/
public $incrementing = false;
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
public function viewable(): MorphTo
{
return $this->morphTo();
}
}