mirror of
https://github.com/brunofontes/shareit.git
synced 2025-11-15 07:50:54 -03:00
Including Items and Products views and controllers
This commit is contained in:
@@ -14,7 +14,12 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
You are logged in!
|
||||
<h4>Your itens</h4>
|
||||
@forelse ($items as $item)
|
||||
<li>{{$item.name}}</li>
|
||||
@empty
|
||||
<p>There are no items for you yet. Include one <a href="/product">here.</a></p>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
41
resources/views/product/index.blade.php
Normal file
41
resources/views/product/index.blade.php
Normal file
@@ -0,0 +1,41 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
|
||||
<form method="POST" action="/product" class="form-inline">
|
||||
<div class="form-group">
|
||||
{{ csrf_field() }}
|
||||
<div class="col"><label for="product">Add Product: </label></div>
|
||||
<div class="col-6"><input type="text" class="form-control" name="product" id="product" placeholder="Book"></div>
|
||||
<div class="col"><button type="submit" class="btn btn-primary">Insert</button></div>
|
||||
</div>
|
||||
</form>
|
||||
<p><br></p>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Products</div>
|
||||
|
||||
<div class="card-body">
|
||||
@if (session('status'))
|
||||
<div class="alert alert-success" role="alert">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<ul>
|
||||
@forelse ($products as $product)
|
||||
<li><a href="/product/{{$product['id']}}">{{$product['name']}}</a></li>
|
||||
@empty
|
||||
<p>There are no products yet. Include one with the form above.</p>
|
||||
@endforelse
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
43
resources/views/product/show.blade.php
Normal file
43
resources/views/product/show.blade.php
Normal file
@@ -0,0 +1,43 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
|
||||
<form method="POST" action="/item" class="form-inline">
|
||||
<div class="form-group">
|
||||
{{ csrf_field() }}
|
||||
<div class="col"><label for="product">Add Item: </label></div>
|
||||
<div class="col-6"><input type="text" class="form-control" name="item" id="item" placeholder="One Hundred Years of Solitude"></div>
|
||||
<div class="col"><button type="submit" class="btn btn-primary">Insert</button></div>
|
||||
</div>
|
||||
</form>
|
||||
<p><br></p>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Product: <strong>{{$product['name']}}</strong>
|
||||
<span class="d-inline-block text-truncat float-right">Edit - Delete</span>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
@if (session('status'))
|
||||
<div class="alert alert-success" role="alert"> {{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<ul>
|
||||
@forelse ($items as $item)
|
||||
<li><a href="/product/{{$item['id']}}">{{$item['name']}}</a></li>
|
||||
@empty
|
||||
<p>There are no items yet. Include one with the form above.</p>
|
||||
@endforelse
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user