PHP Type Comments and Abstract Method Declarations
When the same model data needs to be used across multiple tables, I handled it this way.
GGAMI
/** @var RawBase $modelClass */
$modelClass = $model->getModelClass();When the same model data needs to be used across multiple tables, I handled it this way.
/** @var RawBase $modelClass */
$modelClass = $model->getModelClass();abstract class RawBase extends Model
{
protected $fillable = [
'timestamp',
'data',
'state',
];
abstract public function getModelClass(): string;
abstract public function getInterval(): int;
protected function casts(): array
{
return [
'timestamp' => 'datetime',
'data' => 'json',
];
}
}When the same model data needs to be used across multiple tables, I handled it this way.