-
anyone know how to do this? I want to fetch the data that the users sees, with filters too and no pagination. // RoleListScreen.php
public function query(): iterable
{
$roles = Role::filters(RoleFiltersLayout::class)
->defaultSort('name', 'asc');
return [
'roles' => $roles->paginate(),
'export' => $roles->get()
];
}
public function commandBar(): iterable
{
return [
Button::make('Export CSV')
->icon('cloud-download')
->method('export')
->rawClick(),
];
}
public function export()
{
// i want to get the data with the filters and minus the pagination/chunked, but the data that i fetch is incorrect
dd(
$this->query()['roles']->items()
);
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Specify parameters for the method: public function commandBar(): iterable
{
return [
Button::make('Export CSV')
->icon('cloud-download')
->method('export', request()->all())
->rawClick(),
];
}
public function export()
{
$roles = Role::filters(RoleFiltersLayout::class)
->defaultSort('name', 'asc');
} |
Beta Was this translation helpful? Give feedback.
-
sorry i misclicked the 'mark as answer'. I'm using my Role model already, sorry for wasting your time. i'm gonna debug it for now and will just update it here if i found some solution. <?php
declare(strict_types=1);
namespace App\Orchid\Screens\Role;
use App\Models\Role; // my model
use Orchid\Screen\Action;
use Orchid\Screen\Screen;
use App\Exports\RolesExport;
use App\Orchid\Filters\SearchFilter;
use Maatwebsite\Excel\Facades\Excel;
use App\Orchid\Traits\ExtendOrchidTrait;
use App\Orchid\Layouts\Role\RoleListLayout;
use App\Orchid\Layouts\Role\RoleFiltersLayout;
class RoleListScreen extends Screen
{ |
Beta Was this translation helpful? Give feedback.
-
after so many changes and many trial and error i forgot to edit it back and add the request parameters in the method. thanks it works well now even with soft deleted filter on. // before Button::make('Export CSV')
->icon('cloud-download')
->method('export')
->rawClick(), // after Button::make('Export CSV')
->icon('cloud-download')
->method('export', request()->all())
->rawClick(), |
Beta Was this translation helpful? Give feedback.
Specify parameters for the method: