|
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()
);
} |
Answered by
tabuna
Dec 11, 2023
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');
} |
2 replies
Answer selected by
winex01
|
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
{ |
0 replies
|
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(), |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Specify parameters for the method: