2022-09-20 21:59:52 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2024-06-05 15:35:46 +02:00
|
|
|
use App\Integrations\OAuth\OAuthProviderService;
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
2022-09-20 21:59:52 +02:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
class OAuthProvider extends Model
|
|
|
|
|
{
|
2024-06-05 15:35:46 +02:00
|
|
|
use HasFactory;
|
|
|
|
|
|
2022-09-20 21:59:52 +02:00
|
|
|
/**
|
|
|
|
|
* The table associated with the model.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $table = 'oauth_providers';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The attributes that aren't mass assignable.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The attributes that should be hidden for arrays.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $hidden = [
|
2024-08-29 13:28:02 +02:00
|
|
|
'access_token',
|
|
|
|
|
'refresh_token',
|
2022-09-20 21:59:52 +02:00
|
|
|
];
|
|
|
|
|
|
2024-07-04 20:24:46 +02:00
|
|
|
protected function casts()
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'provider' => OAuthProviderService::class,
|
|
|
|
|
'token_expires_at' => 'datetime',
|
2024-08-29 13:28:02 +02:00
|
|
|
'scopes' => 'array'
|
2024-07-04 20:24:46 +02:00
|
|
|
];
|
|
|
|
|
}
|
2024-06-05 15:35:46 +02:00
|
|
|
|
2022-09-20 21:59:52 +02:00
|
|
|
/**
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
|
*/
|
|
|
|
|
public function user()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(User::class);
|
|
|
|
|
}
|
|
|
|
|
}
|