76 lines
1.8 KiB
PHP
76 lines
1.8 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @package janczakb/filament-short-url
|
|
* @author Bartek Janczak <barek122@gmail.com>
|
|
* @copyright 2026 Bartek Janczak
|
|
* @license Custom Source-Available License (see LICENSE file)
|
|
*/
|
|
|
|
namespace Bjanczak\FilamentShortUrl\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $short_url_id
|
|
* @property string|null $ip_address
|
|
* @property string|null $ip_hash
|
|
* @property string|null $browser
|
|
* @property string|null $browser_version
|
|
* @property string|null $operating_system
|
|
* @property string|null $operating_system_version
|
|
* @property string|null $device_type
|
|
* @property string|null $referer_url
|
|
* @property string|null $country
|
|
* @property string|null $country_code
|
|
* @property Carbon $visited_at
|
|
*/
|
|
class ShortUrlVisit extends Model
|
|
{
|
|
public $timestamps = false;
|
|
|
|
protected $table = 'short_url_visits';
|
|
|
|
protected $fillable = [
|
|
'short_url_id',
|
|
'ip_address',
|
|
'ip_hash',
|
|
'browser',
|
|
'browser_version',
|
|
'operating_system',
|
|
'operating_system_version',
|
|
'device_type',
|
|
'referer_url',
|
|
'referer_host',
|
|
'country',
|
|
'country_code',
|
|
'city',
|
|
'utm_source',
|
|
'utm_medium',
|
|
'utm_campaign',
|
|
'utm_term',
|
|
'utm_content',
|
|
'visited_at',
|
|
'is_bot',
|
|
'is_proxy',
|
|
'is_qr_scan',
|
|
'browser_language',
|
|
];
|
|
|
|
/** @var array<string, string> */
|
|
protected $casts = [
|
|
'visited_at' => 'datetime',
|
|
'is_bot' => 'boolean',
|
|
'is_proxy' => 'boolean',
|
|
'is_qr_scan' => 'boolean',
|
|
];
|
|
|
|
public function shortUrl(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ShortUrl::class, 'short_url_id');
|
|
}
|
|
}
|