index.blade.php 2.57 KB
@extends('layout.admin', ['title' => 'Баннеры'])

@section('content')
    <!-- главный экран -->
    <div class="profile-block-wrapper">
        <div class="profile-block">
            <h2 class="modal-auth__title_">
                Баннеры
            </h2><br>
            <a href="{{ route('admin.banner.create') }}" class="btn banner-container__button" style="margin: 0px;">
                Создать баннер
            </a><br><br>

            <table class="table" style="width: 100%">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>Фото</th>
                    <th>Заголовок</th>
                    <th>Дата создания</th>
                    <th>Действия</th>
                </tr>
                </thead>
                <tbody>
                @if ($banners->count())
                    @foreach($banners as $banner)
                        <tr>
                            <td>{{ $banner->id }}</td>
                            <td><? if (empty($banner->image)) {?>Нет фото<?} else {?>
                                <!--<img src="/storage/app/public/<?//=$area->foto_main; //=asset(Storage::url($area->foto_main))?>" width="100px"/>-->
                                <img src="<?=asset(Storage::url($banner->image))?>" width="100px"/>
                                <?}?></td>

                            <td>{{ $banner->title }}</td>
                            <td>{{ $banner->created_at }}</td>
                            <td> <form action="{{ route('admin.banner.destroy', $banner) }}" method="POST">
                                    <a  href="{{ route('admin.banner.edit', ['banner' => $banner->id]) }}">
                                        Редактировать
                                    </a> |
                                    @csrf
                                    @method('DELETE')
                                    <input class=" btn-danger" type="submit" value="Удалить">
                                </form>
                            </td>
                        </tr>
                    @endforeach
                @else
                    <tr>
                        <td>-</td>
                        <td>-</td>
                        <td>-</td>
                        <td>-</td>
                        <td>-</td>
                    </tr>
                @endif

                </tbody>
            </table>

            {{ $banners->onEachSide(1)->links('catalogs.paginate') }}

        </div>
    </div>
@endsection