<?php namespace Romanah\Gokbakja\Models;

use Model;

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

    use \October\Rain\Database\Traits\SoftDelete;

    protected $dates = ['deleted_at'];

    public $belongsTo = [
        'client' => [
            'Romanah\Gokbakja\Models\Client',
            'key' => 'client_id'
        ],
        'shipping' => [
            'Romanah\Gokbakja\Models\Shipping',
            'key' => 'shipping_id'
        ],
    ];

    public $hasMany = [
        'order_items' => [
            'Romanah\Gokbakja\Models\OrderItem',
            'key' => 'order_id',
            'softDelete' => true
        ],
        'payment' => [
            'Romanah\Gokbakja\Models\Payment',
            'key' => 'order_id',
            'softDelete' => true
        ],
    ];

    /**
     * @var string The database table used by the model.
     */
    public $table = 'romanah_gokbakja_order';

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