Files
Paymenter-Version-Tracks/app/Models/NotificationSubscription.php
Muhammad Tamir b3933b9960 v1.4.0
2025-11-14 10:59:24 +07:00

35 lines
678 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class NotificationSubscription extends Model
{
protected $fillable = [
'user_id',
'endpoint',
'p256dh_key',
'auth_key',
];
protected $casts = [
'p256dh_key' => 'encrypted',
'auth_key' => 'encrypted',
];
public function user()
{
return $this->belongsTo(User::class);
}
public function subscription()
{
return \Minishlink\WebPush\Subscription::create([
'endpoint' => $this->endpoint,
'publicKey' => $this->p256dh_key,
'authToken' => $this->auth_key,
]);
}
}