Lager-v3/app/Models/Brand.php

27 lines
532 B
PHP

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