55 lines
1.1 KiB
PHP
55 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* @property integer $id
|
|
* @property string $name
|
|
* @property string $filter
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
* @property Promo[] $promos
|
|
* @property Promo[] $promo
|
|
* @property Product[] $products
|
|
*/
|
|
class Brand extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'filter',
|
|
'created_at',
|
|
'updated_at'
|
|
];
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
*/
|
|
public function promos()
|
|
{
|
|
return $this->belongsToMany('App\Models\Promo', 'promo_brands');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function promo()
|
|
{
|
|
return $this->hasMany('App\Models\Promo');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function products()
|
|
{
|
|
return $this->hasMany('App\Models\Product');
|
|
}
|
|
}
|