<?php

namespace App\Models;

use App\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Province extends Model
{
    //
    protected $primaryKey = 'provinceid';
    protected $keyType = 'string';
    protected $table = 'province';
    public $timestamps = false;

    //public $timestamps = true;

    protected $fillable = [
        'provinceid',
        'name',
        'type',
        'lat',
        'long',
        'is_search',
        'image'
    ];
    protected $dates = [
    ];

    public function owners()
    {
        return $this->hasMany(User::class, 'province_id', 'provinceid')
            ->where('type', User::OWNER)
            ->where('created_at', '>=', Carbon::now()->startOfYear()->startOfDay());
    }
}
