<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * @property mixed id
 */
class Product extends Model
{
    //use soft delete
    use SoftDeletes;

    protected $fillable = [
        'image',
        'video',
        'video_type',
        'category_id',
        'user_id',
        'visit_counts'
    ];

    /**
     * Return descriptions for Product
     * @return HasMany
     */
    public function descriptions() : HasMany
    {
        return $this->hasMany(ProductDescription::class);
    }

    /**
     * Return category for Product
     * @return BelongsTo
     */
    public function category() :BelongsTo
    {
        return $this->belongsTo(Category::class);
    }


    /**
     * Return other photos for Product
     * @return HasMany
     */
    public function photos () :HasMany
    {
        return $this->hasMany(ProductPhoto::class);
    }

}
