<?php

namespace App\Models;

use App\Services\Repositories\CategoryRepository;
use App\Services\Repositories\GroupRepository;
use App\Services\Repositories\ProductRepository;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\App;

class GroupProduct extends Model
{
    public $timestamps = false;

    protected $fillable = [
        'group_id',
        'product_id',
        'is_active'
    ];

    public function getProductAttribute()
    {
        $productRepository = app(ProductRepository::class);
        $product = $productRepository->checkItem($this->product_id);
        return $product;
    }

    public function getProductGroupAttribute()
    {
        $group = (new GroupRepository())->getItem($this->group_id);
        return $group;
    }

}
