/** * @Post("/cart/test") */ public function test(Request $request) { $client = $request->user; $cart = $request->cart; $totalSum = 0; foreach ($cart as $item) { $itemInShop = ShopItems::find($item['_id']); $totalSum += $itemInShop->price * $item['_quantity']; $items[$item['_data']['partner']][] = ['id' => $itemInShop->id, 'name' => $itemInShop->name, 'price' => $itemInShop->price, 'art' => $itemInShop->art_number, 'description' => mb_substr($itemInShop->description, 0, 200) . '...', 'pic' => $itemInShop->attachment->url, 'quantity' => $item['_quantity']]; } foreach ($items as $id => $positions) { $data = ['items' => $positions, 'client' => $client, 'totalSum' => $totalSum]; // $shop = Shops::find($id); \Mail::send('shops::emails.order', $data, function ($message) { $message->from('*****@*****.**', 'Test'); $message->to('*****@*****.**')->subject('Test'); }); } }
/** * Remove the specified resource from storage. * * @Middleware("auth") */ public function destroy($id) { ShopItems::find($id)->delete(); return back(); }