35 lines
651 B
PHP
35 lines
651 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Pedido extends Model
|
|
{
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
];
|
|
|
|
/**
|
|
* El barrio al que pertenece el pedido.
|
|
*/
|
|
public function barrio(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Barrio::class);
|
|
}
|
|
|
|
/**
|
|
* Los productos que pertenecen al pedido.
|
|
*/
|
|
public function productos(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Producto::class);
|
|
}
|
|
}
|