dusan8061
Terms and conditions
Hey, thanks a lot for an answer. I've already tried breezy, and from what I could see, there is no something like that there.
The column is created, and the checkbox which is pointing it to 'users' table in DB.
Ok, i will check this with the Middleware tomorrow and keep you updated.
Thank you very much!!!!!
8 replies
Pre-select filters in table
it is. but still for the widgets I decided to use approach in widget itself by adding a route :
route('filament.resources.users.index',['tableFilters[role][values][0]' => 5])
it all helped, thank you very much guys!14 replies
Pre-select filters in table
so @Dan Harrin
Tables\Filters\SelectFilter::make('role')
->label(__('Role'))
// ->multiple()
->options(function (){
return Role::all()->pluck('name', 'id')->toArray();
})
->relationship('roles')
->default(5),
The above pre selects the role that I want.
However, the role filter should be a multiple select, and I am not sure how to correctly define a default for that?
I should mention that the team lead doesn't want to go down the scopes route.14 replies
Pre-select filters in table
I don't actually need it, I need it to be pre-selected.
For example - I have roles : admin, staff, customer.. and from the widget, if I am logged in as a customer, the User table should show only the Customers. @Dan Harrin
14 replies
Pre-select filters in table
hey @Dan Harrin
Tables\Filters\SelectFilter::make('organisation_id')
->label(__('Organisation'))
->options(function (){
$organisation = User::select('organisation_id')->groupBy('id', 'organisation_id')->get()->toArray();
return Organisation::select()->whereIn('id', $organisation)->get()->pluck('name',
'id')->toArray();
}),
14 replies
Access table filter in togglable
Hey guys,
I have widget Staff Widget. Depending on the role which user is logged in, I have to create pre-select filter in the table.
So this is StaffWidget.php in widgets folder :
protected function getTableColumns(): array
{
return [
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('roles.name')
];
}
and this is the code from UserResource.php :
Forms\Components\TextInput::make('name')->required(),
Forms\Components\TextInput::make('email')->required(),
Forms\Components\Select::make('organisation')->relationship('organisation', 'name'),
Bottom line, If I am logged in as a customer, role "customers" should be pre-selected on the Users overview page.
Thanks in advance!
@all4 replies