Lager-v3/app/Models/ProductModel.php

29 lines
563 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class ProductModel extends Model
{
use HasFactory, SoftDeletes;
protected $fillable = [
'name',
'brand_id'
];
public function brand()
{
return $this->belongsTo(Brand::class,'brand_id','id')->withTrashed();
}
public function products()
{
return $this->hasMany(Product::class,'product_model_id','id')->withTrashed();
}
}