pai-sklep/resources/views/user.blade.php

34 lines
1 KiB
PHP
Raw Normal View History

2021-12-05 19:23:42 +01:00
@extends('layouts.app')
@section('title', "Sklep")
@section('main')
2021-09-05 02:22:17 +02:00
<p>
2021-12-05 19:23:42 +01:00
<b>Welcome, you are logged in as {{ $user->name }}</b>
</p>
<p>
<a href="/logout"> Logout </a>
2021-09-05 02:22:17 +02:00
</p>
2021-11-19 08:04:04 +01:00
<div>
<h2>Your cart:</h2>
2021-12-05 19:23:42 +01:00
<div>
2021-12-07 12:22:46 +01:00
<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>
2021-11-19 08:04:04 +01:00
@foreach($user->cart as $product)
2021-12-05 19:23:42 +01:00
<div>
2021-12-07 12:22:46 +01:00
<x-product :product="$product" />
2021-12-05 19:23:42 +01:00
</div>
<form action="{{ route("removeFromCart", $product) }}" method="post">
@csrf
2021-12-05 22:01:53 +01:00
<button type="submit"> Remove from cart </button>
2021-12-05 19:23:42 +01:00
</form>
2021-11-19 08:04:04 +01:00
@endforeach()
2021-12-05 19:23:42 +01:00
</div>
2021-11-19 08:04:04 +01:00
</div>
2021-12-05 19:23:42 +01:00
@endsection()