Xavi
Xavi
FFilament
Created by Xavi on 1/10/2025 in #❓┊help
Email verification redirect
How to redirect to cashier checkout (or another page) when user verificate email?
2 replies
FFilament
Created by Xavi on 1/8/2025 in #❓┊help
Listener on verification
How can I create a listener for when the user has verified the email. The idea is that once verified, I create the subscription in cashier
3 replies
FFilament
Created by Xavi on 12/18/2024 in #❓┊help
Not view first record of table
Is it possible to make the first record in a table shows, but when you click on it, a modal appears saying that you do not have permission to access that record? It would only be with the first one, the rest should work normally. The purpose is that only premium users can access the first register Thanks!
6 replies
FFilament
Created by Xavi on 11/27/2024 in #❓┊help
Alert before create button on list
Is it possible to show and alert before create modal its show?. I want to alert user that he has made X questions before create it. This is my header actions code:
protected function getHeaderActions(): array
{
return [
CreateAction::make()
->label(__('Nueva pregunta'))
->visible(fn(): bool => Carbon::parse($this->record->allow_questions_from)->startOfDay()->lte(Carbon::now()->startOfDay()) &&
Carbon::parse($this->record->allow_questions_to)->endOfDay()->gte(Carbon::now()->endOfDay())
)
->form([
Select::make('teacher_id')
->label(__('Teacher'))
->options($this->record->users->pluck('name', 'id')->toArray())
->placeholder(__('Selecciona un docente'))
->visible($this->record->users->count() > 1)
->required(),
TextInput::make('subject')
->label(__('Temática'))
->required(),
Textarea::make('content')
->label(__('Escribe tu pregunta'))
->rows(10)
->required(),
])
->action(
function (array $data) {
$question = CreateQuestionAction::run($data + ['module_id' => $this->record->id]);

$this->dispatch('open-modal', id: 'thank-you-modal', parameters: [
'question' => $question,
]);
})
->createAnother(false)
->modalHeading('')
->icon('heroicon-o-plus')
];
}
protected function getHeaderActions(): array
{
return [
CreateAction::make()
->label(__('Nueva pregunta'))
->visible(fn(): bool => Carbon::parse($this->record->allow_questions_from)->startOfDay()->lte(Carbon::now()->startOfDay()) &&
Carbon::parse($this->record->allow_questions_to)->endOfDay()->gte(Carbon::now()->endOfDay())
)
->form([
Select::make('teacher_id')
->label(__('Teacher'))
->options($this->record->users->pluck('name', 'id')->toArray())
->placeholder(__('Selecciona un docente'))
->visible($this->record->users->count() > 1)
->required(),
TextInput::make('subject')
->label(__('Temática'))
->required(),
Textarea::make('content')
->label(__('Escribe tu pregunta'))
->rows(10)
->required(),
])
->action(
function (array $data) {
$question = CreateQuestionAction::run($data + ['module_id' => $this->record->id]);

$this->dispatch('open-modal', id: 'thank-you-modal', parameters: [
'question' => $question,
]);
})
->createAnother(false)
->modalHeading('')
->icon('heroicon-o-plus')
];
}
Thanks!
5 replies
FFilament
Created by Xavi on 11/25/2024 in #❓┊help
Two list sfor one resource
I have two lists for a single resource: UserInvoiceResource, which includes ListUserInvoice and ListProforma (both using the same '$model'). I've tried adding them as NavigationItems, but the active button on the sidebar isn't working as expected. Does anyone know how to fix this?" Thanks
5 replies
FFilament
Created by Xavi on 11/21/2024 in #❓┊help
Create Page Policy with new parameter
I have a create page for PostResource and i have a parameter media on url ('create' => Pages\CreatePost::route('/create/{media}'), and i get it on page with
#[Url]
public Media $media;
#[Url]
public Media $media;
I want to check if $media status its active to allow users to create a post on this media. How can i get this on Post Policy? Thanks!
2 replies
FFilament
Created by Xavi on 11/20/2024 in #❓┊help
Global search title
No description
7 replies
FFilament
Created by Xavi on 11/19/2024 in #❓┊help
Spatie Translatable with spatie laravel settings
Is it possible to run spatie translatable package with spatie laravel settings. And if is it possible, how?
4 replies
FFilament
Created by Xavi on 11/19/2024 in #❓┊help
Verify email before check subscription
I created a middleware to check if a user's subscription (Cashier) is active. However, I have a problem: the subscription check is performed before the email verification check. How can I solve this? Thanks!
2 replies
FFilament
Created by Xavi on 11/10/2024 in #❓┊help
Header Action Button doesn't show on production on custom panel plugin
Hello. I create my first laravel plugin and first for filament 😉 Its aplugin to show laravel logs. Its a first first version of plugin. It works fine at this moment, but i have a problem and i don't know how to fix. I add a header action for a table (it's in page). In local dev the action button its showed, but on production its not be showed. This is url from plugin https://github.com/xavicabot/filament-log-viewer Any one can install and help me? Thank you so much!
2 replies
FFilament
Created by Xavi on 11/7/2024 in #❓┊help
Set Column with header action
How can i set a text column value by header action button? I try with $set, but it throws this error
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
Thanks
8 replies
FFilament
Created by Xavi on 11/7/2024 in #❓┊help
Importer action inside relationship
I have a Importer Action inside a relationship. How to get owner inside importer to create items? Owner must be Tier2 Model and it must import on Tier2Details Model this is my importaction code
public static function getColumns(): array
{
return [
ImportColumn::make('Url destino')
->label('destination_url')
->requiredMapping()
->rules(['required']),
ImportColumn::make('Anchor Url')
->label('link_url')
->rules(['required'])
->requiredMapping(),
ImportColumn::make('Anchor Keyword')
->label('anchor')
->rules(['required'])
->requiredMapping(),
ImportColumn::make('Fecha de realización')
->label('created_at')
->requiredMapping()
->rules(['required', 'date']),
ImportColumn::make('Follow/Nofollow')
->label('rel')
->requiredMapping()
->rules(['required']),
ImportColumn::make('Tipo')
->requiredMapping()
->rules(['required']),

];
}

public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your tier2 import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';

if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
}

return $body;
}
public static function getColumns(): array
{
return [
ImportColumn::make('Url destino')
->label('destination_url')
->requiredMapping()
->rules(['required']),
ImportColumn::make('Anchor Url')
->label('link_url')
->rules(['required'])
->requiredMapping(),
ImportColumn::make('Anchor Keyword')
->label('anchor')
->rules(['required'])
->requiredMapping(),
ImportColumn::make('Fecha de realización')
->label('created_at')
->requiredMapping()
->rules(['required', 'date']),
ImportColumn::make('Follow/Nofollow')
->label('rel')
->requiredMapping()
->rules(['required']),
ImportColumn::make('Tipo')
->requiredMapping()
->rules(['required']),

];
}

public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your tier2 import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';

if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
}

return $body;
}
5 replies
FFilament
Created by Xavi on 11/7/2024 in #❓┊help
Two list records for same resource active nav
Hi, I have two list pages for the same resource: "List Invoices" and "List Proforma." Both pages function correctly, except for the active sidebar option. When I click on the "List Invoices" option, the sidebar correctly highlights it as active. However, when I click on the "List Proforma" option, the sidebar still incorrectly highlights the "List Invoices" option. How can I resolve this issue?
2 replies
FFilament
Created by Xavi on 11/5/2024 in #❓┊help
TextInput Autocomplete doesn't works
I have a TextInput field where I need to disable autocomplete. I added ->autocomplete(false), but it doesn’t work in production; the field is still populated when editing a record. Is it possible to have the field fill as empty if it’s null (without using the browser’s autocomplete capability)?
3 replies
FFilament
Created by Xavi on 10/24/2024 in #❓┊help
Polling step wizard
I'm making a wizard to connect to Google Analytics, and the first step contains the connect button. The authorization screen to obtain the analytics accounts opens, and what I want is that when I close this screen, I want to automatically go to step 2, which is a select to select which analytics account will be used, and for this I have thought about the first step having a poll. Is this possible? I attach steps image, and this is the code
Tables\Actions\Action::make('connect_analytics')
->icon('heroicon-o-chart-bar')
->label(__('Conectar Google Analytics'))
->steps([
Step::make('step1')
->label(__('Paso 1'))
->description(__('Conecta tu cuenta de Google Analytics'))
->schema([
Actions::make([
Action::make('actionName')
->label(__('Conectar'))
->size('xl')
->extraAttributes([
'class' => 'm-0 auto',
])
->action(function (Media $record, $livewire) {
$url = route('google.auth.redirect', $record);
$livewire->js("window.open('$url', '_blank', 'popup=yes', 'width=350', 'height=250').focus();");
})
//->openUrlInNewTab()
//->url(fn(Media $record) => route('google.auth.redirect', $record))
]),
]),
Step::make('step2')
->label(__('Paso 2'))
->description(__('Selecciona la cuenta de Google Analytics'))
->visible(fn(Media $record) => $record->analyticsAccount)
->schema([
Select::make('analyticsAccount.account_selected')
->options(function (Media $record) {
return Arr::pluck($record->analyticsAccount->accounts, 'name', 'account_id');
})
]),
])
Tables\Actions\Action::make('connect_analytics')
->icon('heroicon-o-chart-bar')
->label(__('Conectar Google Analytics'))
->steps([
Step::make('step1')
->label(__('Paso 1'))
->description(__('Conecta tu cuenta de Google Analytics'))
->schema([
Actions::make([
Action::make('actionName')
->label(__('Conectar'))
->size('xl')
->extraAttributes([
'class' => 'm-0 auto',
])
->action(function (Media $record, $livewire) {
$url = route('google.auth.redirect', $record);
$livewire->js("window.open('$url', '_blank', 'popup=yes', 'width=350', 'height=250').focus();");
})
//->openUrlInNewTab()
//->url(fn(Media $record) => route('google.auth.redirect', $record))
]),
]),
Step::make('step2')
->label(__('Paso 2'))
->description(__('Selecciona la cuenta de Google Analytics'))
->visible(fn(Media $record) => $record->analyticsAccount)
->schema([
Select::make('analyticsAccount.account_selected')
->options(function (Media $record) {
return Arr::pluck($record->analyticsAccount->accounts, 'name', 'account_id');
})
]),
])
Thanks!
2 replies
FFilament
Created by Xavi on 10/23/2024 in #❓┊help
Navigation item bottom
How can I place a navigation item only at the bottom of the sidebar?
11 replies
FFilament
Created by Xavi on 10/22/2024 in #❓┊help
Register colors
I register new colors on Panel with this code:
public function boot(): void
{
FilamentColor::register([
'primary' => Color::hex('#4d8bff'),
'secondary' => Color::hex('#4E8AFF'),
'orange' => Color::hex('#4E8AFF'),
]);
}
public function boot(): void
{
FilamentColor::register([
'primary' => Color::hex('#4d8bff'),
'secondary' => Color::hex('#4E8AFF'),
'orange' => Color::hex('#4E8AFF'),
]);
}
but when i try to use with <x-filament::button color="orange">Test</x-filament::button>, it doesn't works. How can i do it? Thanks!
7 replies
FFilament
Created by Xavi on 10/17/2024 in #❓┊help
Sidebar action modal
Does anyone know if it is possible to add a button on the sidebar to open a modal for the contact form?
7 replies
FFilament
Created by Xavi on 10/14/2024 in #❓┊help
Custom field button color
I create a custom form field to record voice. How to change <x-filament::button> color when i click on it. This is my button code:
<div>
<x-filament::button
type="button"
x-on:click="isRecording ? stopRecording() : startRecording()"
x-text="isRecording ? 'Detener grabación' : 'Iniciar grabación'"
></x-filament::button>
</div>
<div>
<x-filament::button
type="button"
x-on:click="isRecording ? stopRecording() : startRecording()"
x-text="isRecording ? 'Detener grabación' : 'Iniciar grabación'"
></x-filament::button>
</div>
Thanks!
12 replies
FFilament
Created by Xavi on 10/10/2024 in #❓┊help
Full page loading
Is it possible to add, for eaxample when forms saving, a full page loading indicator? Thanks
19 replies