pai-sklep/resources/views/user.blade.php
2021-12-08 00:29:02 +01:00

40 lines
1.2 KiB
PHP

@push('head')
<link rel="stylesheet" href="{{ mix("css/user.css") }}">
@endpush
@extends('layouts.app')
@section('title', "Sklep")
@section('main')
<p>
<b>Welcome, you are logged in as {{ $user->name }}</b>
</p>
<p>
<a href="/logout"> Logout </a>
</p>
<div>
<h2>Your cart:</h2>
<div>
<div class="cart-items">
@foreach($user->cart as $product)
<div class="cart-item">
<x-product :product="$product" />
<form class="remove-cart-form" action="{{ route("removeFromCart", $product) }}" method="post">
@csrf
<button type="submit"> Remove from cart </button>
</form>
</div>
@endforeach()
</div>
<form action="{{ route("order.create") }}" method="post">
@csrf
@foreach($user->cart as $product)
<input type="hidden" name="products[{{ $loop->index }}]" value="{{ $product->uuid }}">
@endforeach()
<button type="submit"> Order </button>
</form>
</div>
</div>
@endsection()