I'm new to laravel and trying voyager admin panel .
I'm adding a custom button in voyager to assign a vendor to every orders .
When admin clicks on custom button, it should send a order id to that new page .
I tried to send a value, but it's not working .
Any helps appreciated .
namespace App\Actions;
use TCG\Voyager\Actions\AbstractAction;
class MyAction extends AbstractAction
{
public function getTitle()
{
return 'Assign to vendor';
}
public function getIcon()
{
return 'voyager-eye';
}
public function getPolicy()
{
return 'read';
}
public function getAttributes()
{
return [
'class' => 'btn btn-sm btn-primary pull-right',
];
}
public function shouldActionDisplayOnDataType()
{
return $this->dataType->slug == 'orders';
}
public function getDefaultRoute()
{
return route('vendors');
}
}
You can just pass the id
of data collection
public function getDefaultRoute()
{
return route('vendors', $this->data->id);
}