<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\GlobalModelEvents;

class Product extends Model
{
    use HasFactory, GlobalModelEvents;

    protected $fillable = [
        'user_id', 'market_id', 'name', 'slug', 'description', 'value', 'quantity', 'initial_quantity', 'old_value', 'status', 'rating', 'image1', 'image2', 'image3', 'category',
    ];

    public function market()
    {
        return $this->belongsTo(Market::class);
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function bids()
    {
        return $this->hasMany(Bid::class);
    }

    public function sells()
    {
        return $this->hasMany(Sell::class);
    }
}
