<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

/**
 * Class ProductAttribute
 *
 * @property int $id
 * @property int $product_id
 * @property int $attribute_id
 * @property Carbon|null $created_at
 * @property Carbon|null $updated_at
 * @property Attribute $attribute
 * @property Product $product
 * @package App\Models
 * @property int $type_id
 * @property-read \App\Models\AttributeType $attribute_type
 * @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute query()
 * @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute whereAttributeId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute whereProductId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute whereTypeId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class ProductAttribute extends Model
{
	protected $table = 'product_attributes';

	protected $casts = [
		'product_id' => 'int',
		'type_id' => 'int',
		'attribute_id' => 'int'
	];

	protected $fillable = [
		'product_id',
		'type_id',
		'attribute_id'
	];

	public function attribute()
	{
		return $this->belongsTo(Attribute::class);
	}

	public function attribute_type()
	{
		return $this->belongsTo(AttributeType::class);
	}

	public function product()
	{
		return $this->belongsTo(Product::class);
	}
}
