Skip to content

Instantly share code, notes, and snippets.

@muskie9
Created May 12, 2022 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muskie9/107df3a689468866da1340c6af1bb4a2 to your computer and use it in GitHub Desktop.
Save muskie9/107df3a689468866da1340c6af1bb4a2 to your computer and use it in GitHub Desktop.
<?php
namespace My\Custom\Namespace;
class MyAdmin extends ModelAdmin
{
private static $managed_models = [
'myModelKey' => [
'dataClass' => MyClass::class,
'title' => 'My Class Title',
],
'myOtherModelKey' => [
'dataClass' => MyOtherClass::class,
'title' => 'My Other Class Title',
],
];
/**
* @return DataList
*/
public function getList()
{
$list = parent::getList();
if ($this->modelTab === 'myModelKey') {
$list = $list->filter([
'ClassName' => MyClass::class,
]);
}
return $list;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment