43 lines
838 B
PHP
43 lines
838 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Brand extends Model
|
|
{
|
|
/** @use HasFactory<\Database\Factories\BrandFactory> */
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var list<string>
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'slug',
|
|
'description',
|
|
'website_url',
|
|
'active',
|
|
];
|
|
|
|
/**
|
|
* Get the attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'active' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function products(): HasMany
|
|
{
|
|
return $this->hasMany(Product::class);
|
|
}
|
|
}
|