<?php namespace TPS\Birzha\Models;

use Model;

/**
 * Model
 */
class City extends Model
{
    use \October\Rain\Database\Traits\Validation;
    
    use \October\Rain\Database\Traits\SoftDelete;

    protected $dates = ['deleted_at'];
    
    public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel'];

    public $translatable = ['name'];
    
    public $hasMany = [
        'products' => [
            'TPS\Birzha\Models\Product',
        ]
    ];
    /**
     * @var string The database table used by the model.
     */
    public $table = 'tps_birzha_cities';
    
     public function getActiveCategoriesOptions()
    {
        $query = City::where('primary_key', 0)
            ->get()
            ->lists('name', 'id');
        // \Log::info($query);
        return $query;
    }

    /**
     * @var array Validation rules
     */
    public $rules = [
    ];
}
