35 lines
634 B
PHP
35 lines
634 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Barrio extends Model
|
|
{
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
];
|
|
|
|
/**
|
|
* La región a la que pertenece el barrio.
|
|
*/
|
|
public function region(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Region::class);
|
|
}
|
|
|
|
/**
|
|
* Los pedidos que pertenecen al barrio.
|
|
*/
|
|
public function pedidos(): HasMany
|
|
{
|
|
return $this->hasMany(Pedido::class);
|
|
}
|
|
}
|