Advertisement
dimkiriakos

Brand index

Jul 26th, 2021
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.63 KB | None | 0 0
  1. @extends('admin.admin_master')
  2. @section('admin')
  3.  
  4.     <div class="py-12">
  5.         <div class="container">
  6.             <div class="row">
  7.                 <div class="col-xl-8 col-lg-8 col-md-8">
  8.  
  9.                     <div class="card text-center">
  10.                         <div class="card-header">All Brands</div>
  11.                         <table class="table">
  12.                             <thead>
  13.                                 <tr>
  14.                                 <th scope="col">#</th>
  15.                                <th scope="col">Brand Name</th>
  16.                                 <th scope="col">Brand Image</th>
  17.                                 <th scope="col">Created At</th>
  18.                                 <th colspan="2" scope="col">Action</th>
  19.                                 </tr>
  20.                             </thead>
  21.                             <tbody>
  22.                                 @if (count($brands))
  23.  
  24.                                     @foreach ($brands as $key => $brand)
  25.                                     <tr>
  26.  
  27.  
  28.                                         <td>{{ $brands->firstItem() + $loop->index }}</td>
  29.                                         <td>{{ $brand->brand_name }}</td>
  30.                                         <td>
  31.                                             <img src="{{ asset('image/brand') }}/{{ $brand->brand_image }}" width="70px" alt="" srcset="">
  32.  
  33.                                         </td>
  34.                                         <td>
  35.                                             @if ($brand->created_at == NULL )
  36.  
  37.                                                 <span>No Date set</span>
  38.                                             @else
  39.                                                 <span>{{ Carbon\Carbon::parse($brand->created_at)->diffForHumans() }}</span>
  40.                                             @endif
  41.                                         </td>
  42.                                         <td><a href="{{ route('edit.brands', [$brand->id]) }}" class="btn btn-info">Edit</a></td>
  43.                                         <td>
  44.                                             <form action="{{ route('delete.brand', [$brand->id]) }}" method="POST">@csrf
  45.                                                 @method('DELETE')
  46.                                                 <button type="submit" class="btn btn-danger">Delete</button>
  47.                                             </form>
  48.                                         </td>
  49.                                     @endforeach
  50.                                 </tr>
  51.                                 @else
  52.                                 <tr>
  53.  
  54.                                     <td colspan="6">No Brands Added yet</td>
  55.                                 </tr>
  56.                                 @endif
  57.                             </tbody>
  58.                         </table>
  59.  
  60.  
  61.                     </div>
  62.                 </div>
  63.  
  64.                 <div class="col-xl-4 col-lg-4 col-md-4">
  65.                     <div class="card">
  66.                         <div class="card-header">Add Brand</div>
  67.                         <div class="card-body">
  68.                             <form action="{{ route('add.brand') }}" method="post" enctype="multipart/form-data">
  69.                                 @csrf
  70.                                 <div class="form-group">
  71.                                     <label for="">Brand Name</label>
  72.                                     <input class="form-control @error('brand_name') is-invalid @enderror" type="text" name="brand_name" placeholder="Type the brand name">
  73.                                     @error('brand_name')
  74.                                         <span class="text-danger">{{ $message }}</span>
  75.                                     @enderror
  76.                                 </div>
  77.                                 <div class="form-group">
  78.                                     <label for="">Brand Image</label>
  79.                                     <input class="form-control @error('brand_image') is-invalid @enderror" type="file" name="brand_image" placeholder="upload the brand image">
  80.                                     @error('brand_image')
  81.                                         <span class="text-danger">{{ $message }}</span>
  82.                                     @enderror
  83.                                 </div>
  84.                                 <button class="btn btn-primary form-control" type="submit">Add Brand</button>
  85.                             </form>
  86.                         </div>
  87.                     </div>
  88.                 </div>
  89.             </div>
  90.  
  91.  
  92.  
  93.         </div>
  94.  
  95.         {{-- Trashed --}}
  96.  
  97.  
  98.  
  99.     </div>
  100. @endsection
  101.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement