<?php

namespace App\Models;

use App\Notifications\NewsSubscribed;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\Notifiable;

class NewsSubscriber extends Model
{
    use HasFactory;
    use SoftDeletes;
    use Notifiable;

    protected $fillable = [
        'email',
    ];
    
    public static function boot()
    {
        parent::boot();


        self::created(function($model){
            $model->notify(new NewsSubscribed());
        });
    }
}
