I want to insert some data to database, I need id that I can get from my route and quantity. But my quantity keep define as null. This is my view
<form method="POST" action="" enctype="multipart/form-data" >
<input type="hidden" name="_token" value="">
<div class="form-group">
<label for="exampleInputEmail1">Jumlah Beli :</label>
<input type="name" class="form-control" name ="quantity" id="quantity" placeholder="Jumlah">
</div>
<div class="mt-4">
<div class="btn btn-default btn-lg btn-flat">
<i class=" fa-lg mr-2"></i> <a href="">
Beli Produk </a>
</div>
</form>
and this is my Controller
public function tambah(Request $request, $id)
{
$idtoko = Store::select('id')->where('users_id',Auth::user()->id)->first();
$transaksi = new Transaction();
$transaksi->quantity = $request->get('quantity');
$transaksi->stores_id = $idtoko->id;
$transaksi->save();
}
And this is my route Route::get('/beli/{id}','KeranjangController@tambah');
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire