<?php

namespace App\Modules\Stock;

use App\Models\ValidationModel;
use App\Modules\Stock\Stock;

class StockGroup extends ValidationModel
{
    /**
     *	The attributes that won't be assigned during
     *	a mass assignment.
     */
    protected $guarded = ['id'];

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'stock_groups';

    /**
     * Array of validation rules.
     *
     * @var  array
     */
    protected static $rules = [
        'name'                 => 'required|unique:stock_groups,name,$id',
                    'type' => 'required',
            'purchase_type' => 'required',
    ];

    public function stock()
    {
        return $this->hasMany(Stock::class);
    }
}
