25 lines
505 B
PHP
25 lines
505 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class PushSubscription extends Model
|
|
{
|
|
protected $fillable = [
|
|
'id_usuario',
|
|
'tipo_usuario',
|
|
'endpoint',
|
|
'p256dh',
|
|
'auth',
|
|
];
|
|
|
|
/**
|
|
* Relación polimórfica manual (ya que no usamos el User estándar de Laravel siempre)
|
|
*/
|
|
public function scopeParaUsuario($query, $tipo, $id)
|
|
{
|
|
return $query->where('tipo_usuario', $tipo)->where('id_usuario', $id);
|
|
}
|
|
}
|