芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/kwesioben.com/paymoney/app/DataTables/Admin/TicketsDataTable.php
eloquent($this->query()) ->editColumn('created_at', function ($ticket) { return dateFormat($ticket->created_at); })->editColumn('user_id', function ($ticket) { $user = getColumnValue($ticket->user); if ($user <> '-' && Common::has_permission(auth('admin')->user()->id, 'edit_user')) { return '
' . $user . '
'; } return $user; })->addColumn('subject', function ($ticket) { $subject = $ticket->subject; return (Common::has_permission(auth('admin')->user()->id, 'edit_ticket')) ? '
' . $subject . '
' : $subject; })->editColumn('ticket_status_id', function ($ticket) { return isset($ticket->ticket_status->name) ? getStatusLabel($ticket->ticket_status->name) : ''; })->editColumn('last_reply', function ($ticket) { return $ticket->last_reply ? dateFormat($ticket->last_reply) : __('No Reply Yet'); })->addColumn('action', function ($ticket) { $edit = (Common::has_permission(auth('admin')->user()->id, 'edit_ticket')) ? '
' : ''; $delete = (Common::has_permission(auth('admin')->user()->id, 'delete_ticket')) ? '
' : ''; return $edit . $delete; }) ->rawColumns(['user_id', 'subject', 'ticket_status_id', 'action']) ->make(true); } public function query() { $status = isset(request()->status) ? request()->status : 'all'; $user = isset(request()->user_id) ? request()->user_id : null; $from = isset(request()->from) ? setDateForDb(request()->from) : null; $to = isset(request()->to) ? setDateForDb(request()->to) : null; $query = (new Ticket())->getTicketsList($from, $to, $status, $user); return $this->applyScopes($query); } public function html() { return $this->builder() ->addColumn(['data' => 'id', 'name' => 'tickets.id', 'title' => __('ID'), 'searchable' => false, 'visible' => false]) ->addColumn(['data' => 'created_at', 'name' => 'tickets.created_at', 'title' => __('Date')]) ->addColumn(['data' => 'user_id', 'name' => 'user.last_name', 'title' => __('User'), 'visible' => false]) ->addColumn(['data' => 'user_id', 'name' => 'user.first_name', 'title' => __('User')]) ->addColumn(['data' => 'subject', 'name' => 'tickets.subject', 'title' => __('Subject')]) ->addColumn(['data' => 'ticket_status_id', 'name' => 'ticket_status.name', 'title' => __('Status')]) ->addColumn(['data' => 'priority', 'name' => 'tickets.priority', 'title' => __('Priority')]) ->addColumn(['data' => 'last_reply', 'name' => 'tickets.last_reply', 'title' => __('Last Reply')]) ->addColumn(['data' => 'action', 'name' => 'action', 'title' => __('Action'), 'orderable' => false, 'searchable' => false]) ->parameters(dataTableOptions()); } }