<?php

namespace App\Models;

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

class District extends Model{
    use HasFactory;
    protected $table = 'district';
    
    protected $fillable = [
        'name',
        'status',
        'created_at',
        'updated_at',
        'state_id'
    ];

    public function export($slug){
        $collection = DB::table('district')
                        ->select('name','status');

        
        $data = $collection->get();
        
        if($data->isNotEmpty()){
            return $data;
        }else{
            return null;
        }
    }
}
