Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 10 additions & 7 deletions src/Screens/ListScreen.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down