/home/kueuepay/public_html/app/Models/Frontend/Announcement.php
<?php

namespace App\Models\Frontend;

use App\Constants\GlobalConst;
use Illuminate\Database\Eloquent\Model;
use App\Models\Frontend\AnnouncementCategory;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class Announcement extends Model
{
    use HasFactory;

    protected $guarded = ['id'];

    protected $casts = [
        'data'      => 'object',
    ];

    public function getRouteKeyName()
    {
        return "slug";
    }

    public function category() {
        return $this->belongsTo(AnnouncementCategory::class,"announcement_category_id");
    }

    public function scopeActive($query) {
        return $query->where("status",GlobalConst::ACTIVE);
    }
}
Best Practice

Best Practices

To ensure a smooth integration process and optimal performance, follow these best practices:

  1. Use secure HTTPS connections for all API requests.
  2. Implement robust error handling to handle potential issues gracefully.
  3. Regularly update your integration to stay current with any API changes or enhancements.