1
0

index.blade.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. @extends('admin.layouts.app')
  2. @section('content')
  3. <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
  4. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
  5. <h1 class="h2">文章</h1>
  6. <form class="form-inline" action="{{ route('admin.blog.article.list') }}">
  7. <label class="sr-only col-form-label-sm" for="slug">slug</label>
  8. <input type="text" class="form-control form-control-sm mb-2 mr-sm-2" id="slug" name="slug" value="{{ $history['slug'] }}"
  9. placeholder="slug">
  10. <label class="sr-only col-form-label-sm" for="title">标题</label>
  11. <input type="text" class="form-control form-control-sm mb-2 mr-sm-2" id="title" name="title" value="{{ $history['title'] }}"
  12. placeholder="标题">
  13. <div class="input-group mb-2 mr-sm-2">
  14. <label class="sr-only" for="cate_id">分类</label>
  15. <select class="form-control form-control-sm" id="cate_id" name="cate_id">
  16. <option value="" selected>--不分类--</option>
  17. @foreach($categories as $category)
  18. <option value="{{ $category['id'] }}" {{ $history['cate_id'] == $category['id'] ? 'selected' : '' }}>{{ $category['cate_name'] }}</option>
  19. @endforeach
  20. </select>
  21. </div>
  22. <div class="form-check mb-2 mr-sm-2">
  23. <input class="form-check-input" type="checkbox" name="is_top" id="is_top"
  24. value="1" {{ $history['is_top'] ? 'checked' : '' }}>
  25. <label class="form-check-label" for="is_top">
  26. 只看置顶
  27. </label>
  28. </div>
  29. <button type="submit" class="btn btn-sm btn-primary mb-2">查找</button>
  30. </form>
  31. <div class="btn-toolbar mb-2 mb-md-0">
  32. <div class="btn-group mr-2">
  33. <a class="btn btn-sm btn-outline-secondary" href="{{ route('admin.blog.article.new') }}">创作</a>
  34. <a class="btn btn-sm btn-outline-secondary" href="{{ route('admin.blog.article.list') }}">列表</a>
  35. {{--<button class="btn btn-sm btn-outline-secondary">Share</button>--}}
  36. {{--<button class="btn btn-sm btn-outline-secondary">Export</button>--}}
  37. </div>
  38. {{--<button class="btn btn-sm btn-outline-secondary dropdown-toggle">--}}
  39. {{--<span data-feather="calendar"></span>--}}
  40. {{--This week--}}
  41. {{--</button>--}}
  42. </div>
  43. </div>
  44. {{--<canvas class="my-4" id="myChart" width="900" height="380"></canvas>--}}
  45. @include('admin.layouts.pagination')
  46. <div class="table-responsive">
  47. <table class="table table-striped table-sm">
  48. <thead>
  49. <tr>
  50. <th>#</th>
  51. {{--<th>Slug</th>--}}
  52. <th>标题</th>
  53. <th>分类</th>
  54. <th>阅读</th>
  55. <th>时间</th>
  56. <th>操作</th>
  57. </tr>
  58. </thead>
  59. <tbody>
  60. @foreach($data as $i => $article)
  61. <tr>
  62. <td>{{ $i+1 }}</td>
  63. {{-- <td>{{ $article['slug'] }}</td>--}}
  64. <td class="text-nowrap overflow-slh">{{ $article['title'] }}</td>
  65. <td>{{ $article['category']['cate_name'] }}</td>
  66. <td>{{ $article['read_count'] }}</td>
  67. <td>{{ vn_time($article['created_at']) }}</td>
  68. <td>
  69. <a href="{{ route('admin.blog.article.edit', ['id' => $article['id']]) }}"
  70. class="btn btn-sm btn-outline-secondary py-0 pr-1 pl-1">编辑</a>
  71. <a href="{{ route('admin.blog.article.top') }}"
  72. class="btn btn-sm btn-outline-secondary py-0 pr-1 pl-1"
  73. onclick="event.preventDefault();document.getElementById('top-form-{{$article['id']}}').submit();">
  74. @if($article['is_top'])
  75. {{ __('取消') }}
  76. @else
  77. {{ __('置顶') }}
  78. @endif
  79. </a>
  80. <a href="{{ route('admin.blog.article.delete') }}"
  81. class="btn btn-sm btn-outline-secondary py-0 pr-1 pl-1"
  82. onclick="event.preventDefault();document.getElementById('delete-form-{{$article['id']}}').submit();">
  83. {{ __('删除') }}
  84. </a>
  85. <form id="top-form-{{$article['id']}}" action="{{ route('admin.blog.article.top') }}"
  86. method="POST" style="display: none;">
  87. @csrf
  88. <input type="hidden" name="id" value="{{ $article['id'] }}">
  89. <input type="hidden" name="is_top" value="{{ $article['is_top'] ? 0 : 1 }}">
  90. </form>
  91. <form id="delete-form-{{$article['id']}}" action="{{ route('admin.blog.article.delete') }}"
  92. method="POST" style="display: none;">
  93. @csrf
  94. <input type="hidden" name="id" value="{{ $article['id'] }}">
  95. </form>
  96. </td>
  97. </tr>
  98. @endforeach
  99. </tbody>
  100. </table>
  101. </div>
  102. </main>
  103. @endsection