<?php

namespace App\Models\Admin;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Language extends Model
{
    use HasFactory;

    protected $fillable = [
        'title',
        'read',
        'short',
        'code',
        'flag',
        'status',
        'default',
        'ordernum',
    ];

    public function scopeSearch($query, $keyword)
    {
        return $query->where('title', 'like', '%' . $keyword . '%')
            ->orWhere('short', 'like', '%' . $keyword . '%')
            ->orWhere('code', 'like', '%' . $keyword . '%');
    }
}
