pai-sklep/resources/views/product/edit.blade.php
2021-12-08 18:25:48 +01:00

30 lines
859 B
PHP

@extends('layouts.app')
@section('title', "Sklep")
@section('main')
@if($new)
@php($post_url = route("product.store"))
@else
@php($post_url = route("product.update", $product))
@endif
<form action="{{ $post_url }}" method="post" enctype="multipart/form-data">
<input type="text" name="name" value="{{ $product->name }}">
<textarea name="description">{{ $product->description }}</textarea>
<input type="number" name="price" value="{{ $product->price }}">
<input type="file" name="image">
<button type="submit">Zatwierdź</button>
@if(!$new)
@method("PATCH")
@endif
@csrf
</form>
@foreach($product->images as $vis)
<form action="{{ route("image.destroy", $vis) }}" method="post">
<img src="{{ $vis->URL() }}"/>
<button type="submit">Usuń</button>
@method("DELETE")
@csrf
</form>
@endforeach()
@endsection()