pedi3/app/Models/Categoria.php

27 lines
484 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Categoria extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
];
/**
* Los productos que pertenecen a la categoría.
*/
public function productos(): HasMany
{
return $this->hasMany(Producto::class);
}
}