Becker Maxime
Becker Maxime
FFilament
Created by Becker Maxime on 10/23/2024 in #❓┊help
Problem Dehydrated Multiple Select
No description
9 replies
FFilament
Created by Becker Maxime on 10/22/2024 in #❓┊help
All Tenant
Would it be possible to add an option 'All' in the tenant selector that allows users to view all the resources they have access to, for example: (All, team 1, team 2)?
13 replies
FFilament
Created by Becker Maxime on 10/18/2024 in #❓┊help
FileUpload multi-node
I have set up a FilamentPHP v2 & v3 application on a multi-node Docker architecture without shared volumes between the containers. For file uploads, I am using S3, as my containers do not have persistent local volumes. However, I am encountering an issue: files are not always uploaded correctly. This problem becomes more frequent as I add more nodes to the cluster. This behavior seems to be related to how file uploads are handled in a multi-node environment, since everything works fine when I only use a single node. Here are my assumptions based on my observations: 1. Initial upload: When a user uploads a file, it might be temporarily stored on the node that received the request. 2. Multi-node issue: In a multi-node setup, the server that receives the file and temporarily stores it may be different from the one that handles the final operation, such as saving it to S3. If each node has its own isolated local storage, this could explain why the file upload occasionally fails, especially when multiple nodes are involved. To try to resolve this issue, I configured Traefik with sticky sessions, so that each user is consistently directed to the same node for their requests. Unfortunately, this doesn’t seem to completely fix the problem, or there may be an issue with my Traefik configuration. Do you have any advice or solutions for effectively handling file uploads in a multi-node Docker environment, especially with setups like this? Any suggestions would be appreciated. Here is the code:
Forms\Components\FileUpload::make('attachments')
->label(__('artist_event-resource.field.attachments'))
->columnSpan(3)
->disk('s3')
->visibility('private')
->directory('/artist'),
Forms\Components\FileUpload::make('attachments')
->label(__('artist_event-resource.field.attachments'))
->columnSpan(3)
->disk('s3')
->visibility('private')
->directory('/artist'),
2 replies
FFilament
Created by Becker Maxime on 9/16/2024 in #❓┊help
Is it possible to have a minimum width for the text input column in mobile?
No description
5 replies
FFilament
Created by Becker Maxime on 8/29/2024 in #❓┊help
responsive repeater
No description
2 replies
FFilament
Created by Becker Maxime on 6/28/2024 in #❓┊help
Form modification recovery problem
I can't retrieve changes from my edit form. Do you have a solution ?
protected function getSaveFormAction(): Action
{
dd($this->form->getState());
if (auth()->user()->artist->modify_number_invoice == 0) {
return Action::make('save')
->requiresConfirmation()
->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
->action(function ($data) {
// dd($this->form->getState());
$artist = auth()->user()->artist;
if ($artist->number_invoice != $data['number_invoice']) {
$artist->number_invoice = $data['number_invoice'];
$artist->save();
}
parent::save();
})
->modalHeading(
'Si vous confirmez, vous ne pourrez plus modifier le début de l\'indexation des numéros de la facture.'
)
->modalDescription(
'Êtes-vous sûr de vouloir utiliser ce numéro ?'
)
->form([
TextInput::make('number_invoice')
->label(__('artist-resource.field.number_invoice'))
->numeric()
->formatStateUsing(function () {
return auth()->user()->artist->number_invoice;
})
])
->submit(null)
->keyBindings(['mod+s']);
} else {
return Action::make('save')
->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
->submit('save')
->keyBindings(['mod+s']);
}
}
protected function getSaveFormAction(): Action
{
dd($this->form->getState());
if (auth()->user()->artist->modify_number_invoice == 0) {
return Action::make('save')
->requiresConfirmation()
->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
->action(function ($data) {
// dd($this->form->getState());
$artist = auth()->user()->artist;
if ($artist->number_invoice != $data['number_invoice']) {
$artist->number_invoice = $data['number_invoice'];
$artist->save();
}
parent::save();
})
->modalHeading(
'Si vous confirmez, vous ne pourrez plus modifier le début de l\'indexation des numéros de la facture.'
)
->modalDescription(
'Êtes-vous sûr de vouloir utiliser ce numéro ?'
)
->form([
TextInput::make('number_invoice')
->label(__('artist-resource.field.number_invoice'))
->numeric()
->formatStateUsing(function () {
return auth()->user()->artist->number_invoice;
})
])
->submit(null)
->keyBindings(['mod+s']);
} else {
return Action::make('save')
->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
->submit('save')
->keyBindings(['mod+s']);
}
}
2 replies
FFilament
Created by Becker Maxime on 11/15/2023 in #❓┊help
filepload display problem
My image is saved in storage/app/public but is not displayed in my component, whereas in v2 I had the preview. Is there any configuration to be done?
10 replies
FFilament
Created by Becker Maxime on 11/14/2023 in #❓┊help
reactive action
Hello, Is it possible with livewire v3 to simulate a page reload, i.e. to update a page action dynamically without reloading the page?
4 replies
FFilament
Created by Becker Maxime on 10/31/2023 in #❓┊help
Action update a component
Is it possible to update a component after an action? example :
EditRecord.php getHeaderActions():
Action::make('paid_deposit_amount')
->label(__('quote-resource.action.paid_deposit_amount'))
->requiresConfirmation()
->url(fn($record): string => route('generate.payement.quote', ['id' => $record->id]))
->openUrlInNewTab()
->hidden(function ($record) {
return !is_numeric($record->artist->vat_rate)
|| !is_numeric($record->deposit_amount)
|| !$record->artist->key_stripe
|| $record->status == Quote::PAID;
}),
Action::make('paid_deposit_amount')
->label(__('quote-resource.action.paid_deposit_amount'))
->requiresConfirmation()
->url(fn($record): string => route('generate.payement.quote', ['id' => $record->id]))
->openUrlInNewTab()
->hidden(function ($record) {
return !is_numeric($record->artist->vat_rate)
|| !is_numeric($record->deposit_amount)
|| !$record->artist->key_stripe
|| $record->status == Quote::PAID;
}),
Resource.php form():
Forms\Components\Select::make('status')
->disabled(function ($record) {
return $record?->invoice;
})
->options([
Quote::UNPAID => 'Non payé',
Quote::PENDING => 'En attente',
Quote::PAID => 'Payé',
])
->label(__('quote-resource.field.status')),
Forms\Components\Select::make('status')
->disabled(function ($record) {
return $record?->invoice;
})
->options([
Quote::UNPAID => 'Non payé',
Quote::PENDING => 'En attente',
Quote::PAID => 'Payé',
])
->label(__('quote-resource.field.status')),
I'd like my buttons to appear when I update my selection without having to reload the page. Is this possible?
2 replies
FFilament
Created by Becker Maxime on 10/27/2023 in #❓┊help
Update repeater
https://flareapp.io/share/VmeWKgz7
SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause'
update
`artist_lead`
SET
`artist_id` = 16,
`artist_lead`.`updated_at` = 2023 -10 -27 13: 50: 46
WHERE
`` = 15
AND `` = 15
SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause'
update
`artist_lead`
SET
`artist_id` = 16,
`artist_lead`.`updated_at` = 2023 -10 -27 13: 50: 46
WHERE
`` = 15
AND `` = 15
Repeater::make('leadArtists')
->required()
->relationship()
->label(__('lead-resource.repeater.field.artists'))
->schema([
Forms\Components\Select::make('artist_id')
->searchable()
->relationship('artist', 'name')
->getSearchResultsUsing(fn(string $search): array => Artist::where('name', 'like', "{$search}%")
->orWhere('first_name', 'like', "{$search}%")
->orWhere('zip_code', 'like', "{$search}%")
->select('id', 'name', 'first_name', 'zip_code')
->limit(50)
->get()
->mapWithKeys(fn($artist) => [$artist->id => "{$artist->first_name} {$artist->name} - {$artist->zip_code}"])
->toArray())
->getOptionLabelUsing(function ($value): ?string {
$artist = Artist::find($value);
return "{$artist->first_name} {$artist->name} - {$artist->zip_code}";
})
->label(__('lead-resource.repeater.field.name'))
->columnSpan(2),
Repeater::make('leadArtists')
->required()
->relationship()
->label(__('lead-resource.repeater.field.artists'))
->schema([
Forms\Components\Select::make('artist_id')
->searchable()
->relationship('artist', 'name')
->getSearchResultsUsing(fn(string $search): array => Artist::where('name', 'like', "{$search}%")
->orWhere('first_name', 'like', "{$search}%")
->orWhere('zip_code', 'like', "{$search}%")
->select('id', 'name', 'first_name', 'zip_code')
->limit(50)
->get()
->mapWithKeys(fn($artist) => [$artist->id => "{$artist->first_name} {$artist->name} - {$artist->zip_code}"])
->toArray())
->getOptionLabelUsing(function ($value): ?string {
$artist = Artist::find($value);
return "{$artist->first_name} {$artist->name} - {$artist->zip_code}";
})
->label(__('lead-resource.repeater.field.name'))
->columnSpan(2),
why my fields are empty ?
25 replies
FFilament
Created by Becker Maxime on 10/27/2023 in #❓┊help
Repeater pivot
Hi, I'm having a problem with the repeater. My problem: I've created a pivot table but I don't understand why it doesn't go into the pivot table but into the artist table, so it creates a new artist for me every time I add it, when my aim is for it to register only in my pivot table.
Repeater::make('artists')
->required()
->relationship()
->label(__('lead-resource.repeater.field.artists'))
->schema([
Forms\Components\Select::make('artists')
->searchable()
->getSearchResultsUsing(fn(string $search): array =>
Artist::where('name', 'like', "{$search}%")
->orWhere('first_name', 'like', "{$search}%")
->orWhere('zip_code', 'like', "{$search}%")
->select('id', 'name', 'first_name', 'zip_code')
->limit(50)
->get()
->mapWithKeys(fn($artist) => [$artist->id => "{$artist->first_name} {$artist->name} - {$artist->zip_code}"])
->toArray())
->getOptionLabelUsing(function ($value): ?string {
$artist = Artist::find($value);
return "{$artist->first_name} {$artist->name} - {$artist->zip_code}";
})
->label(__('lead-resource.repeater.field.name'))
->columnSpan(2),
Repeater::make('artists')
->required()
->relationship()
->label(__('lead-resource.repeater.field.artists'))
->schema([
Forms\Components\Select::make('artists')
->searchable()
->getSearchResultsUsing(fn(string $search): array =>
Artist::where('name', 'like', "{$search}%")
->orWhere('first_name', 'like', "{$search}%")
->orWhere('zip_code', 'like', "{$search}%")
->select('id', 'name', 'first_name', 'zip_code')
->limit(50)
->get()
->mapWithKeys(fn($artist) => [$artist->id => "{$artist->first_name} {$artist->name} - {$artist->zip_code}"])
->toArray())
->getOptionLabelUsing(function ($value): ?string {
$artist = Artist::find($value);
return "{$artist->first_name} {$artist->name} - {$artist->zip_code}";
})
->label(__('lead-resource.repeater.field.name'))
->columnSpan(2),
7 replies
FFilament
Created by Becker Maxime on 10/23/2023 in #❓┊help
Error configure.php
I'd like to create a filament plugin, I've retrieved the "Filament Plugin Skeleton" template, but I get an error when I type php./configure.php PHP Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /home/beckerm/Projects/customers-management/configure.php on line 139
13 replies
FFilament
Created by Becker Maxime on 10/12/2023 in #❓┊help
Widget Table
I'd like to create a modal that allows me to open the form. What can I do?
class TracksEvent extends TableWidget
{
protected static string $view = 'filament.resources.event-resource.widgets.tracks-event';

public ?Event $record = NULL;
protected int|string|array $columnSpan = "full";

public function addTracks()
{

}

protected function getTableHeaderActions(): array
{

return [
Action::make('import_playlist')
->label(__('event-resource.widget.tracks-event.action.import_playlist'))
->modalHeading("Ajouter des dates d'absences")
->requiresConfirmation()
->button()
->action('addTracks')
->form([
Select::make('tracks.playlist')
->relationship('tracks')
->required(),
]),
];
}
class TracksEvent extends TableWidget
{
protected static string $view = 'filament.resources.event-resource.widgets.tracks-event';

public ?Event $record = NULL;
protected int|string|array $columnSpan = "full";

public function addTracks()
{

}

protected function getTableHeaderActions(): array
{

return [
Action::make('import_playlist')
->label(__('event-resource.widget.tracks-event.action.import_playlist'))
->modalHeading("Ajouter des dates d'absences")
->requiresConfirmation()
->button()
->action('addTracks')
->form([
Select::make('tracks.playlist')
->relationship('tracks')
->required(),
]),
];
}
8 replies
FFilament
Created by Becker Maxime on 10/11/2023 in #❓┊help
Open a new tab
Is it possible to open this url in a new tab?
Action::make('paid_deposit_amount')
->label(__('quote-resource.action.paid_deposit_amount'))
->requiresConfirmation()
->action(function ($record) {
$url = Quote::createStripeSession($record, $record->artist);
return redirect($url);
})
->hidden(function ($record) {
return (bool)$record->invoice;
}),
Action::make('paid_deposit_amount')
->label(__('quote-resource.action.paid_deposit_amount'))
->requiresConfirmation()
->action(function ($record) {
$url = Quote::createStripeSession($record, $record->artist);
return redirect($url);
})
->hidden(function ($record) {
return (bool)$record->invoice;
}),
11 replies
FFilament
Created by Becker Maxime on 10/10/2023 in #❓┊help
why use a relationship manager?
Hello, I've created a custom page but I can't make a ship relationship on my section. I get an error: Call to a member function quote() on null What can I do?
<?php

namespace App\Filament\Resources\InvoiceResource\Pages;

use App\Filament\Resources\InvoiceResource;
use App\Models\Invoice;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Resources\Pages\Page;

class ViewInvoice extends Page
{
protected static string $resource = InvoiceResource::class;

protected static string $view = 'filament.resources.invoice-resource.pages.view-invoice';

public ?Invoice $record = NULL;

public function getTitle(): string
{
return __('invoice-resource.viewInvoice.title');
}

protected function getFormSchema(): array
{
$tab = array();
// if ($this->record->method_payment == Invoice::BANK_TRANSFER) {
$tab = [
Group::make()
->schema([
Section::make(__('invoice-resource.section.invoice_information'))
->relationship('quote', 'this')
->schema([
Select::make('name')
->options(function () {
dd($this->record->quote);
return $record->quote;
})
->label(__('artist-resource.field.name')),
])
])
];
// }
return $tab;
}
}
<?php

namespace App\Filament\Resources\InvoiceResource\Pages;

use App\Filament\Resources\InvoiceResource;
use App\Models\Invoice;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Resources\Pages\Page;

class ViewInvoice extends Page
{
protected static string $resource = InvoiceResource::class;

protected static string $view = 'filament.resources.invoice-resource.pages.view-invoice';

public ?Invoice $record = NULL;

public function getTitle(): string
{
return __('invoice-resource.viewInvoice.title');
}

protected function getFormSchema(): array
{
$tab = array();
// if ($this->record->method_payment == Invoice::BANK_TRANSFER) {
$tab = [
Group::make()
->schema([
Section::make(__('invoice-resource.section.invoice_information'))
->relationship('quote', 'this')
->schema([
Select::make('name')
->options(function () {
dd($this->record->quote);
return $record->quote;
})
->label(__('artist-resource.field.name')),
])
])
];
// }
return $tab;
}
}
2 replies
FFilament
Created by Becker Maxime on 10/9/2023 in #❓┊help
need or not relation manager to display data in a custom page
Hello, I've created a custom page but I can't make a ship relationship on my section. I get an error: Call to a member function quote() on null What can I do?
<?php

namespace App\Filament\Resources\InvoiceResource\Pages;

use App\Filament\Resources\InvoiceResource;
use App\Models\Invoice;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Resources\Pages\Page;

class ViewInvoice extends Page
{
protected static string $resource = InvoiceResource::class;

protected static string $view = 'filament.resources.invoice-resource.pages.view-invoice';

public ?Invoice $record = NULL;

public function getTitle(): string
{
return __('invoice-resource.viewInvoice.title');
}

protected function getFormSchema(): array
{
$tab = array();
// if ($this->record->method_payment == Invoice::BANK_TRANSFER) {
$tab = [
Group::make()
->schema([
Section::make(__('invoice-resource.section.invoice_information'))
->relationship('quote', 'this')
->schema([
Select::make('name')
->options(function () {
dd($this->record->quote);
return $record->quote;
})
->label(__('artist-resource.field.name')),
])
])
];
// }
return $tab;
}
}
<?php

namespace App\Filament\Resources\InvoiceResource\Pages;

use App\Filament\Resources\InvoiceResource;
use App\Models\Invoice;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Resources\Pages\Page;

class ViewInvoice extends Page
{
protected static string $resource = InvoiceResource::class;

protected static string $view = 'filament.resources.invoice-resource.pages.view-invoice';

public ?Invoice $record = NULL;

public function getTitle(): string
{
return __('invoice-resource.viewInvoice.title');
}

protected function getFormSchema(): array
{
$tab = array();
// if ($this->record->method_payment == Invoice::BANK_TRANSFER) {
$tab = [
Group::make()
->schema([
Section::make(__('invoice-resource.section.invoice_information'))
->relationship('quote', 'this')
->schema([
Select::make('name')
->options(function () {
dd($this->record->quote);
return $record->quote;
})
->label(__('artist-resource.field.name')),
])
])
];
// }
return $tab;
}
}
2 replies
FFilament
Created by Becker Maxime on 10/9/2023 in #❓┊help
text input relationShip
Hello, I can't get my quote via the form.
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Group::make()
->schema([
Forms\Components\Section::make(__('quote-resource.section.client_information'))
->schema([
Forms\Components\TextInput::make('quote.name')
->label(__('quote-resource.field.name'))
->required()
->maxLength(255),
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Group::make()
->schema([
Forms\Components\Section::make(__('quote-resource.section.client_information'))
->schema([
Forms\Components\TextInput::make('quote.name')
->label(__('quote-resource.field.name'))
->required()
->maxLength(255),
I'm in my resource, I don't understand why I can't get my quote since it works in my table.
9 replies
FFilament
Created by Becker Maxime on 10/5/2023 in #❓┊help
navigationGroups translate
Hello, I'd like to sort my groups by adding my translation. Is this possible?
8 replies
FFilament
Created by Becker Maxime on 8/29/2023 in #❓┊help
pop-up window when the account is about to be disconnected
I would like to display a pop-up window indicating that the user is about to be logged out.
3 replies
FFilament
Created by Becker Maxime on 8/29/2023 in #❓┊help
filter problem
I'm getting an error when I filter for my signed enrolments: nothing is displayed.
protected function getTableFilters(): array
{
return [
Filter::make('is_signed')->label('Archive')->query(function (Builder $query, array $data): Builder {
if ($data['isActive'] === true) {
return $query->where('is_signed', true);
}
return $query;
}),
];
}
protected function getTableFilters(): array
{
return [
Filter::make('is_signed')->label('Archive')->query(function (Builder $query, array $data): Builder {
if ($data['isActive'] === true) {
return $query->where('is_signed', true);
}
return $query;
}),
];
}
16 replies