<?php

namespace App\Models;

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

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

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

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