One thing we currently cannot do with this package, is use the default Nova Action visibility properties, (e.g. public $showOnIndex = false;) to effect the DetachedAction button in order to hide it on the Index view.
We may need to add a property and helper method to DetachedAction in order to set the visibility for the Vue component:
<?php
namespace Brightspot\Nova\Tools\DetachedActions;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Actions\ActionMethod;
use Laravel\Nova\Exceptions\MissingActionHandlerException;
use Laravel\Nova\Http\Requests\ActionRequest;
use Laravel\Nova\Nova;
abstract class DetachedAction extends Action
{
...
/**
* Indicates if this action is only available on the custom index toolbar.
*
* @var bool
*/
public $showOnIndexToolbar = true;
/**
* Determine if the action is to be shown on the custom index toolbar.
*
* @return bool
*/
public function shownOnIndexToolbar()
{
return $this->showOnIndexToolbar;
}
/**
* Prepare the action for JSON serialization.
*
* @return array
*/
public function jsonSerialize()
{
return array_merge([
'detachedAction' => true,
'label' => $this->label(),
'showOnIndexToolbar' => $this->shownOnIndexToolbar(),
], parent::jsonSerialize(), $this->meta());
}
...
One thing we currently cannot do with this package, is use the default Nova Action visibility properties, (e.g.
public $showOnIndex = false;
) to effect theDetachedAction
button in order to hide it on the Index view.We may need to add a property and helper method to
DetachedAction
in order to set the visibility for the Vue component: