55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
class Brand extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var list<string>
|
|
*/
|
|
protected $fillable = [
|
|
'name'
|
|
];
|
|
|
|
// * RELATIONSHIPS
|
|
|
|
/**
|
|
* Get the urls for the brand.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\Url, $this>
|
|
*/
|
|
public function urls()
|
|
{
|
|
return $this->hasMany(Url::class);
|
|
}
|
|
|
|
/**
|
|
* Get the urls for the brand.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\Service, $this>
|
|
*/
|
|
public function services()
|
|
{
|
|
return $this->hasMany(Service::class);
|
|
}
|
|
|
|
/**
|
|
* The users that belong to the brand.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<\App\Models\User,
|
|
* $this,
|
|
* \Illuminate\Database\Eloquent\Relations\Pivot>
|
|
*/
|
|
public function users(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(User::class);
|
|
}
|
|
}
|