Training Part 1.1;
This commit is contained in:
24
resources/views/components/table.blade.php
Normal file
24
resources/views/components/table.blade.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
@props(['items' => []])
|
||||||
|
@props(['fields' => []])
|
||||||
|
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Word</th>
|
||||||
|
<th>Translation</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
@forelse ($items as $item)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $item->{$fields[0]} }}</td>
|
||||||
|
<td>{{ $item->{$fields[1]} }}</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td class="text-center" colspan="2">No words</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
@@ -1,23 +1,26 @@
|
|||||||
<x-app-layout>
|
<x-app-layout>
|
||||||
<table class="table table-striped">
|
{{-- <table class="table table-striped">--}}
|
||||||
<thead>
|
{{-- <thead>--}}
|
||||||
<tr>
|
{{-- <tr>--}}
|
||||||
<th>Word</th>
|
{{-- <th>Word</th>--}}
|
||||||
<th>Translation</th>
|
{{-- <th>Translation</th>--}}
|
||||||
</tr>
|
{{-- </tr>--}}
|
||||||
</thead>
|
{{-- </thead>--}}
|
||||||
<tbody>
|
{{-- <tbody>--}}
|
||||||
|
|
||||||
@forelse ($words as $word)
|
{{-- @forelse ($words as $word)--}}
|
||||||
<tr>
|
{{-- <tr>--}}
|
||||||
<td>{{$word->name}}</td>
|
{{-- <td>{{$word->name}}</td>--}}
|
||||||
<td>{{$word->translation}}</td>
|
{{-- <td>{{$word->translation}}</td>--}}
|
||||||
</tr>
|
{{-- </tr>--}}
|
||||||
@empty
|
{{-- @empty--}}
|
||||||
<tr>
|
{{-- <tr>--}}
|
||||||
<td class="text-center" colspan="2">No words</td>
|
{{-- <td class="text-center" colspan="2">No words</td>--}}
|
||||||
</tr>
|
{{-- </tr>--}}
|
||||||
@endforelse
|
{{-- @endforelse--}}
|
||||||
</tbody>
|
{{-- </tbody>--}}
|
||||||
</table>
|
{{-- </table>--}}
|
||||||
|
|
||||||
|
|
||||||
|
<x-table :items="$words" :fields="array('name','translation')" />
|
||||||
</x-app-layout>
|
</x-app-layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user