Closed GeorgeBarlow closed 4 years ago
Looks like you're not extending DetachedAction
.
<?php
namespace App\Nova\Actions;
use Brightspot\Nova\Tools\DetachedActions\DetachedAction;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Collection;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Fields\ActionFields;
class Refresh extends DetachedAction
{
use InteractsWithQueue, Queueable, SerializesModels;
/**
* Get the displayable label of the button.
*
* @return string
*/
public function label()
{
return __('Export Users');
}
/**
* Perform the action.
*
* @param ActionFields $fields
*
* @return mixed
*/
public function handle(ActionFields $fields)
{
// Do work to export records
return DetachedAction::message('It worked!');
}
/**
* Get the fields available on the action.
*
* @return array
*/
public function fields()
{
return [];
}
}
Thank you so much, really appreciate it! Have a nice weekend :)
Hi,
Any reason why this is happening? I thought the button should show left of Create User, rather than being placed within a dropdown. I used the sample code by the way and just changed the title to refresh instead. This is probably me not reading the docs properly but it would be really helpful if you could just point me in the right direction, sorry to waste anyone's time with this.