45 lines
913 B
PHP
45 lines
913 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class StravaConnection extends Model
|
|
{
|
|
use HasUlids;
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'athlete_id',
|
|
'access_token',
|
|
'refresh_token',
|
|
'expires_at',
|
|
'scopes',
|
|
'athlete',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'access_token',
|
|
'refresh_token',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'athlete_id' => 'integer',
|
|
'access_token' => 'encrypted',
|
|
'refresh_token' => 'encrypted',
|
|
'expires_at' => 'datetime',
|
|
'scopes' => 'array',
|
|
'athlete' => 'array',
|
|
];
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|