mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-09-03 03:05:01 +02:00
59 lines
1.2 KiB
PHP
59 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models\Aggregate;
|
|
|
|
use CyrildeWit\EloquentViewable\Contracts\Viewable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|
|
|
/**
|
|
* Class ViewAggregate.
|
|
*
|
|
* @property Viewable $viewable
|
|
* @property string $viewable_type
|
|
* @property int $viewable_id
|
|
* @property int $value
|
|
*/
|
|
class ViewAggregate extends Model
|
|
{
|
|
final public const TABLE = 'view_aggregates';
|
|
|
|
final public const ATTRIBUTE_VIEWABLE = 'viewable';
|
|
final public const ATTRIBUTE_VIEWABLE_TYPE = 'viewable_type';
|
|
final public const ATTRIBUTE_VIEWABLE_ID = 'viewable_id';
|
|
final public const 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;
|
|
|
|
/**
|
|
* Get the viewable of the aggregate.
|
|
*
|
|
* @return MorphTo
|
|
*/
|
|
public function viewable(): MorphTo
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
}
|