diff --git a/src/Resource.php b/src/Resource.php index 6c16766..d88ef7a 100644 --- a/src/Resource.php +++ b/src/Resource.php @@ -145,6 +145,15 @@ public static function nameWithoutResource(): string return 'Resource'; }); } + /** + * Get the Create Button should be displayed in the ListScreen + * + * @return string|null + */ + public static function displayCreateButtonInList(): bool + { + return true; + } /** * Get the text for the create resource button. diff --git a/src/Screens/ListScreen.php b/src/Screens/ListScreen.php index e562d7f..24ab912 100644 --- a/src/Screens/ListScreen.php +++ b/src/Screens/ListScreen.php @@ -35,13 +35,16 @@ public function query(IndexRequest $request): array */ public function commandBar(): array { - return [ - $this->actionsButtons(), - Link::make($this->resource::createButtonLabel()) - ->route('platform.resource.create', $this->resource::uriKey()) - ->canSee($this->can('create')) - ->icon('bs.plus-circle'), - ]; + $actions[] = $this->actionsButtons(); + + if($this->resource::displayCreateButtonInList()){ + $actions[] = Link::make($this->resource::createButtonLabel()) + ->route('platform.resource.create', $this->resource::uriKey()) + ->canSee($this->can('create')) + ->icon('plus'); + } + + return $actions; } /**