list.blade.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. @extends('admin.frame_list')
  2. @section('content_btn')
  3. <a href="{{ route('course_add') }}">添加课程</a>
  4. @stop
  5. @section('table_data')
  6. <tr>
  7. <th>课程名称</th>
  8. <th>所属菜单</th>
  9. <th>课程日期</th>
  10. <th>创建时间</th>
  11. <th>修改时间</th>
  12. <th>人数</th>
  13. <th>操作</th>
  14. </tr>
  15. @foreach ($courses as $course)
  16. <tr>
  17. <td>{{ $course->name }}</td>
  18. <td>
  19. @foreach ($course->belong as $menu_id)
  20. {{ $menu_home->find($menu_id)->name }},
  21. @endforeach
  22. </td>
  23. @if ( $course->start_date && $course->end_date )
  24. <td>{{ $course->start_date }} ~ {{ $course->end_date }}</td>
  25. @else
  26. <td></td>
  27. @endif
  28. <td>{{ $course->created_at }}</td>
  29. <td>{{ $course->updated_at }}</td>
  30. <td>{{ $course_userNum = $course->coursesUser->count() }}/{{ $course->user_num }}</td>
  31. <td>
  32. @if ($course_userNum)
  33. <a href="{{ route('course_user', ['id' => $course->id]) }}">报名列表</a> |
  34. @endif
  35. <!-- 已结束的不能编辑 -->
  36. @if (!$course->end_date || strtotime(date('Y-m-d H:i:s', time())) < strtotime($course->end_date))
  37. <a href="{{ route('course_upd', ['id' => $course->id]) }}">编辑</a>
  38. @endif
  39. <!-- 未开始的才能删除 -->
  40. @if ($course->start_date && strtotime(date('Y-m-d H:i:s', time())) < strtotime($course->start_date))
  41. | <a href="{{ route('course_del', ['id' => $course->id]) }}" onclick="if(!confirm('确定要删除吗?')) return false;">删除</a>
  42. @endif
  43. </td>
  44. </tr>
  45. @endforeach
  46. @stop
  47. @section('render_data')
  48. {{ $courses->render() }}
  49. @stop