mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-09-03 03:05:01 +02:00
51 lines
1.1 KiB
PHP
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();
|
|
}
|
|
}
|