Mantenedor de compras!

This commit is contained in:
2021-07-14 03:58:17 -04:00
parent 4b71bc67aa
commit 0816f37611
9 changed files with 436 additions and 29 deletions

View File

@@ -11,8 +11,17 @@ class Compra extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'compras';
protected $fillable = [
'id', 'fecha_compra', 'proveedor_id', 'en_arqueo', 'restaurante_id'
];
public function compraIngredientes() {
public static function findOrFail($id) {
$compra = Compra::find($id);
if(!$compra) throw new ModelNotFoundException("compra", $id);
return $compra;
}
public function ingredientes() {
return $this->hasMany(CompraIngrediente::class);
}