<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;

class Country extends Model
{
    protected $fillable = ['continent_id', 'name', 'slug', 'flag_emoji', 'is_active', 'posts_count'];
    protected $casts    = ['is_active' => 'boolean'];

    public function continent() { return $this->belongsTo(Continent::class); }
    public function sources()   { return $this->hasMany(Source::class); }
    public function posts()     { return $this->hasMany(Post::class); }

    public function scopeActive($q) { return $q->where('is_active', true); }
}
