<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * @property integer $constituency_id
 * @property integer $county_id
 * @property integer $created_by
 * @property string $constituency_name
 * @property string $constituency_code
 * @property integer $status
 * @property string $created
 * @property string $modified
 * @property County $county
 * @property User $user
 */
class Constituency extends Model
{
    /**
     * The table associated with the model.
     * 
     * @var string
     */
    protected $table = 'constituency';

    /**
     * The primary key for the model.
     * 
     * @var string
     */
    protected $primaryKey = 'constituency_id';

    /**
     * The "type" of the auto-incrementing ID.
     * 
     * @var string
     */
    protected $keyType = 'integer';

    public $timestamps = false;

    /**
     * @var array
     */
    protected $fillable = ['county_id', 'created_by', 'constituency_name',
     'constituency_code', 'status', 'created', 'modified'];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function county()
    {
        return $this->belongsTo('App\Models\County', 'county_id', 'county_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function user()
    {
        return $this->belongsTo('App\Models\User', 'created_by', 'user_id');
    }
}
