What happens is that when you refresh the page you create a product automatically (it is the last product you enter), that is, you are inserting it when you refresh the page repeatedly, and the other problem is that when you just entered the second product, you It shows the first one in the table, it's as if it's outdated.
Sent the code Thank you!
addInsumos.blade.php TABLE
<div class="panel-body" style="margin-top: 200px;">
<table class="table table-bordered" id="myTable">
<head>
<th>Id</th>
<th>Nombre</th>
<th>Categoria</th>
<th>fecha</th>
<tbody>
@foreach ($insumos as $insumos )
<tr>
<td>{{$insumos->id}}</td>
<td>{{$insumos->nombre}}</td>
<td>{{$insumos->categoria}}</td>
<td>{{$insumos->created_at}}</td>
</tr>
@endforeach
</tbody>
</head>
</table>
</div>
insumosController.php CONTROLLER
function viewaddinsumo()
{
//Ver la tabla
$insumos = \App\insumos::latest('id')
->take(5)
->get();
return view('Insumos/addInsumo',compact('insumos'));
}// _____
//WW||
function sendforminsumo(Request $request) //·.·||
{
//insertar el producto o insumo
$insumos = \App\insumos::latest('id')->take(5)->get();
$name = $request->input('nameP');
$categoriaP = $request->get('categoriaP');
DB::table('insumos')->insert(['nombre'=>$name, 'categoria'=>$categoriaP]);
return view('Insumos/addInsumo',compact('insumos'));
}