first commit
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class AnalyticsSession extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'website_id',
|
||||
'visitor_id',
|
||||
'uid',
|
||||
'started_at',
|
||||
'ended_at',
|
||||
'duration',
|
||||
'is_bounce',
|
||||
'entry_page',
|
||||
'exit_page',
|
||||
'pages_count',
|
||||
'ip_address',
|
||||
'referrer_url',
|
||||
'referrer_domain',
|
||||
'utm_source',
|
||||
'utm_medium',
|
||||
'utm_campaign',
|
||||
'utm_term',
|
||||
'utm_content',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'started_at' => 'datetime',
|
||||
'ended_at' => 'datetime',
|
||||
'is_bounce' => 'boolean',
|
||||
'duration' => 'integer',
|
||||
'pages_count' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function website(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Website::class);
|
||||
}
|
||||
|
||||
public function visitor(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Visitor::class);
|
||||
}
|
||||
|
||||
public function pageViews(): HasMany
|
||||
{
|
||||
return $this->hasMany(PageView::class);
|
||||
}
|
||||
|
||||
public function events(): HasMany
|
||||
{
|
||||
return $this->hasMany(Event::class);
|
||||
}
|
||||
|
||||
public function goalConversions(): HasMany
|
||||
{
|
||||
return $this->hasMany(GoalConversion::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user