ApplyController.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: ring
  5. * Date: 2019/7/23
  6. * Time: 上午11:46
  7. */
  8. namespace App\Admin\Controllers;
  9. use App\Models\Apply;
  10. use Encore\Admin\Controllers\AdminController;
  11. use Encore\Admin\Form;
  12. use Encore\Admin\Grid;
  13. class ApplyController extends AdminController
  14. {
  15. protected $title = '红娘申请';
  16. protected function grid()
  17. {
  18. $grid = new Grid(new Apply());
  19. $grid->id('ID')->sortable();
  20. // 'tel','sex', 'name','age','occupation','file1','file2','file3','cardpros','cardcons'
  21. $grid->column('tel','申请人电话');
  22. $grid->column('name', '姓名');
  23. $grid->column('age', '年龄');
  24. $grid->column('occupation', '职业');
  25. $grid->column('school', '毕业学校');
  26. $grid->column('km', '距离');
  27. $grid->column('sex', '性别')->display(function ($ios) {
  28. if($ios==1){
  29. $msg='男';
  30. }
  31. if($ios==2){
  32. $msg='女';
  33. }
  34. return $msg;
  35. })->sortable();
  36. $grid->addColumn('其他证件','放大')->display(function () {
  37. return "<a href='$this->file1' target='_blank'>图1</a>-<a href='$this->file2' target='_blank'>图2</a>-<a href='$this->file3' target='_blank'>图3</a>";
  38. });
  39. $grid->addColumn('身份证','放大')->display(function () {
  40. return "<a href='$this->cardpros' target='_blank'>放大</a>-<a href='$this->cardcons' target='_blank'>放大</a>";
  41. });
  42. $grid->column('status', '标记?')->sortable()->editable('select', [1 => '完成', 2 => '拒绝', 0 => '申请']);
  43. $grid->created_at('申请时间')->sortable();
  44. $grid->column('uid','查看申请人ID')->display(function ($uid) {
  45. return "<a href='/admin/users/$uid/edit#tab-form-2' target='_blank'>去开通</a>";
  46. });
  47. $grid->disableExport();
  48. $grid->disableCreateButton();
  49. $grid->disableRowSelector();
  50. $grid->disableColumnSelector();
  51. $grid->disableActions();
  52. $grid->model()->orderBy('id', 'desc');
  53. return $grid;
  54. }
  55. protected function form()
  56. {
  57. $form = new Form(new Apply);
  58. $form->text('status', '广告名')->rules('required|min:1');
  59. return $form;
  60. }
  61. }