Skip to content
Snippets Groups Projects
Product.php 422 B
<?php

namespace App\Models;

use App\Models\Category;
use App\Models\Product;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'retailer_id',
    ];

    public function categories()
    {
        return $this->belongsToMany(Category::class, 'category_product');
    }
}