created at added, test filter added

This commit is contained in:
Mahri Ilmedova 2022-09-20 11:43:52 +05:00 committed by ilmedova
parent febc3bb19f
commit a7b2a30805
3 changed files with 15 additions and 2 deletions

View File

@ -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);
});
}
/**

View File

@ -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
];
}
}

View File

@ -6,6 +6,6 @@
}
},
"github-oauth": {
"github.com": "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"
"github.com": "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"
}
}