This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
How can I show the soft deleted (http://laravel.com/docs/eloquent#soft-deleting) elements as a list. Same format of the active elements.?
thanks
Add this to your Controller
public function listExtendQuery($query)
{
$query->withTrashed();
}
public function formExtendQuery($query)
{
$query->withTrashed();
}
Thanks @daftspunk
But the idea is to have a list of trashed items and a list of active items. Sorry if my question was not so clear. I want to reuse the active list, but filtering by soft deleted / active.
Thanks and sorry my english.
Last updated
Thanks @daftspunk!
@planetadeleste, we seem to have have found a solution with a partner
If your template contains this
$this->listRender('trashed')
then you need to add a condition
public function listExtendQuery($query, $definition)
{
if ($definition == 'trashed')
{
$query->onlyTrashed();
}
}
Last updated
d.negativa said:
Thanks @daftspunk!
@planetadeleste, we seem to have have found a solution with a partner
If your template contains this$this->listRender('trashed')
then you need to add a condition
public function listExtendQuery($query, $definition) { if ($definition == 'trashed') { $query->onlyTrashed(); } }
You also need to add a config for that definition in your Controller:
public $listConfig = [
'list' => 'config_list.yaml',
'trashed' => 'config_list_trashed.yaml'
];
HI guy, i have one question. how do i make a list view to show the trashed list. so on the toolbar of my list i have a view trashed button which directs to /trashed.
thanks
1-8 of 8