<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Models\UserBrands;
use App\Categoria;

class BrandDb extends Model
{
    protected $table = 'brands_data_base';

    protected $fillable = [
        'id',
        'Key',
        'Code',
        'Description',
        'name_online',
        'user_nav',
    ];

    public function vendor()
    {
        return $this->belongsTo(UserBrands::class, 'Code', 'brand');
    }
    public function categories()
    {
        return $this->belongsToMany(
            Categoria::class,
            'brand_categories',
            'brand_id',
            'category_id'
        );
    }
}
