<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use App\Models\User;

class AdminNotification extends Model {

    public $table = 'admin_notifications';
    public $primaryKey = 'id';

    protected $fillable = ['cta_label'];

    public function instigator(): belongsTo {
        return $this->belongsTo(User::class);
    }

    public function latest($column = 'created_at')
    {
        return $this->orderBy($column, 'desc');
    } 
}
