Merge pull request #1853 from leocavalcante/feature-list-extend-records
Make available to extends Lists records
This commit is contained in:
commit
fd3fbf5e52
|
|
@ -163,6 +163,10 @@ class ListController extends ControllerBehavior
|
|||
$this->controller->listExtendQuery($query, $definition);
|
||||
});
|
||||
|
||||
$widget->bindEvent('list.extendRecords', function ($records) use ($definition) {
|
||||
$this->controller->listExtendRecords($records, $definition);
|
||||
});
|
||||
|
||||
$widget->bindEvent('list.injectRowClass', function ($record) use ($definition) {
|
||||
return $this->controller->listInjectRowClass($record, $definition);
|
||||
});
|
||||
|
|
@ -463,6 +467,15 @@ class ListController extends ControllerBehavior
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Controller override: Extend the records used for populating the list
|
||||
* after the query is processed.
|
||||
* @param Illuminate\Contracts\Pagination\LengthAwarePaginator|Illuminate\Database\Eloquent\Collection $records
|
||||
*/
|
||||
public function listExtendRecords($records, $definition = null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Controller override: Extend the query used for populating the filter
|
||||
* options before the default query is processed.
|
||||
|
|
|
|||
|
|
@ -524,6 +524,16 @@ class Lists extends WidgetBase
|
|||
$records = $model->get();
|
||||
}
|
||||
|
||||
/*
|
||||
* Extensibility
|
||||
*/
|
||||
if (
|
||||
($event = $this->fireEvent('list.extendRecords', [$records], true)) ||
|
||||
($event = Event::fire('backend.list.extendRecords', [$this, $records], true))
|
||||
) {
|
||||
$records = $event;
|
||||
}
|
||||
|
||||
return $this->records = $records;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue