Hemanath
pxlrbt-excel(I am using different roles based on need to export the column fromTable)
I am using the export feature in Filament v2 where I have specified 'fromTable'. However, I need to display the text column based on the user's role. It appears correctly, but it is not functioning as expected with that column. Are there any possibilities in Filament to make a column visible or to use any other condition?
ExportAction::make()
->label(trans('app.students.header_action.export_excel'))
->exports([
ExcelExport::make('table')
->withFilename('Students')
->fromTable()
->withChunkSize(500000),
]),
TextColumn::make('business_name') ->visible(function () { $franchisee = Model::find(Session::get('current_franchisee')); $result = false; if (in_array($franchisee->type, [config('constants.franchisee_types.sm'), config('constants.franchisee_types.so'), config('constants.franchisee_types.sf')])) { $result = true; } return $result; })
TextColumn::make('business_name') ->visible(function () { $franchisee = Model::find(Session::get('current_franchisee')); $result = false; if (in_array($franchisee->type, [config('constants.franchisee_types.sm'), config('constants.franchisee_types.so'), config('constants.franchisee_types.sf')])) { $result = true; } return $result; })
4 replies
When Changing url should not work in filament any method
I am using multiple logins and provider ,using middleware , i called in my every pages and resources those middleware's what i need http://exam.test/student when changing student to admin after /its should not work any possibilities we are having filament ..can you give guide anyone solutions
4 replies
Created a Laravel component for a pdf action, inside a custom page i used this:
Action::make('certificate')->button()->label('Certificate PDF')
->action(function () {
$pdfUrl = route('competition-certificate-print', [
'franchisee' => $this->franchisee->id,
'competition' => $this->record->id,
]);
$this->dispatchBrowserEvent('open-pdf-modal', ['url' => $pdfUrl, 'title' => 'Certificate PDF', 'fileName' => 'Competition']);
}),
for the custom page blade file i used this : <x-pdf-action />
it worked, now i want to use that inside a resource action, how can i achieve this in there.
1 replies
Unable to resolve repeater text input problem
i am using repeater. When i define some base price inside text input its not taking after typed 500; its show only 5 automatically removing inside the textbox 00 values how to resolve any solution in filament or anyone advise me to resolve the issue...
6 replies
'SelectColumn ' i am using in my project
SelectColumn::make('status')
->options([
'draft' => 'Draft',
'reviewing' => 'Reviewing',
'published' => 'Published',
]) This is my code i am saved inside the table field like status ,but i need to save one more place inside Json field so how to update the field using select column can anyone explain or how to achieve this?
3 replies
pxlrbt/filament-excel ExportAction
protected function getTableHeaderActions(): array
{
return [
ExportAction::make()
->label('Export')
->exports([
ExcelExport::make()
->withFilename('Materials sales report')
->withColumns([
])->fromTable(),
]),
];
} this is my code i need to give default(0) for withcolumns any possibilities to give ..?
Please suggest me any other way.
1 replies
Filament Access
What I am trying to do: I want give filament access to the particular user role.
What I did: I used public function canAccessFilament(): bool inside the user model.
My issue/the error:
Cannot redeclare App\Models\User::canAccessFilament()
Code:
public function canAccessFilament(): bool
{
return $this->role != 'member';
}
11 replies
How use ->action() and ->url
I trying use the form and send the form data through the ->url(), if i use ->url() without opening the form it is redirecting to the url.
Action::make('Print Label')
->action(function ($record, array $data) {
//
})
->url(
fn (Despatch $record, array $data): string => route('web.despatchprintlable', ['record' => $record, 'space' => Arr::get($data, 'space_no')]),
shouldOpenInNewTab: true
)
->icon('heroicon-s-download')
->visible(function ($record) {
$transactions = Transaction::find($record->transaction_ids);
$flag = false;
foreach ($transactions as $k => $transaction) {
if ($transaction->sub_master_id == config('constants.transaction_types.cm_request')) {
$flag = true;
break;
}
}
return ($flag) ? true : false;
})
->form([
TextInput::make('space_no')->numeric()->minValue(0)->required(),
])
->modalWidth('xl')
->modalbutton('Print Lable'), this is the code.
6 replies
Forms\Components\Repeater::make('addresses')->relationship('addresses')
i am using the relationship in the repeater , but i am not getting that repeater data inside the handleRecordCreation(array $data) $data variable. How to get that data without removing the ->relationship.
4 replies