35 lines
751 B
PHP
35 lines
751 B
PHP
<?php
|
|
|
|
namespace IriksIT\Manager\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/**
|
|
* One visit to the public site. `day` is kept as a plain 'Y-m-d' string on
|
|
* purpose: see the migration.
|
|
*
|
|
* @property string $day
|
|
*/
|
|
class Visit extends Model
|
|
{
|
|
public $timestamps = false;
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'started_at' => 'datetime',
|
|
'last_seen_at' => 'datetime',
|
|
'hour' => 'integer',
|
|
'weekday' => 'integer',
|
|
'page_views' => 'integer',
|
|
'seconds' => 'integer',
|
|
];
|
|
}
|
|
|
|
/** @return HasMany<PageView, $this> */
|
|
public function pageViews(): HasMany
|
|
{
|
|
return $this->hasMany(PageView::class);
|
|
}
|
|
}
|