created at added, test filter added
This commit is contained in:
parent
febc3bb19f
commit
a7b2a30805
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Requests\TicketRequest;
|
||||
use App\Models\Status;
|
||||
use Backpack\CRUD\app\Http\Controllers\CrudController;
|
||||
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
|
||||
|
||||
|
|
@ -28,6 +29,17 @@ public function setup()
|
|||
CRUD::setModel(\App\Models\Ticket::class);
|
||||
CRUD::setRoute(config('backpack.base.route_prefix') . '/ticket');
|
||||
CRUD::setEntityNameStrings('ticket', 'tickets');
|
||||
|
||||
// dropdown filter
|
||||
$this->crud->addFilter([
|
||||
'name' => 'status',
|
||||
'type' => 'dropdown',
|
||||
'label' => 'Status'
|
||||
], function(){
|
||||
return Status::get()->pluck('id','name');
|
||||
}, function($value) { // if the filter is active
|
||||
$this->crud->addClause('where', 'status', $value);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ public function toArray($request)
|
|||
'title' => $this->title,
|
||||
'content' => $this->content,
|
||||
'status' => $this->status->name,
|
||||
'last_sender' => $this->last_sender
|
||||
'last_sender' => $this->last_sender,
|
||||
'created_at' => $this->created_at
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue