index.blade.php 2.66 KB
@extends('layout.admin', ['title' => 'Сообщения сайту'])

@section('content')
    <section class="favorites">
        <div class="favorites-top">
            <div class="container">
                <div class="breadcrumbs">
                    <ul class="breadcrumbs__list">
                        <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('user.index') }}">Главная</a></li>
                        <li class="breadcrumbs__item"><span class="breadcrumbs__link">Сообщения сайту </span></li>
                    </ul>
                </div>
                <h1 class="favorites__title title-main">Сообщения сайту</h1>
            </div>
        </div>
        <div class="favorites-cnt">
            <div class="container">
                <table class="table" style="width: 100%">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>От</th>
                        <th>Тема</th>
                        <th>Дата</th>
                        <th>Действия</th>
                    </tr>
                    </thead>
                    <tbody>
                    @if ($messages->count())
                        @foreach($messages as $msg)
                            <tr>
                                <td>{{ $msg->id }}</td>
                                <td>{{ $msg->from }}</td>
                                <td>{{ $msg->subject }}</td>
                                <td>{{ $msg->created_at }}</td>
                                <td> <form action="{{ route('admin.message.destroy', $msg) }}" method="POST">
                                        <a href="{{ route('admin.message.show', $msg) }}">Просмотр</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>
                {{ $messages->onEachSide(1)->links('catalogs.paginate') }}
                <div class="favorites__items">

                </div>
            </div>
        </div>
    </section>
@endsection