malebestia.
manage a parameter inside the Importer
Hi everyone,
for the first time I'm using the new csv import, inside a ManageRelatedRecords page.
inside the importer I would need to manage the id of the parent object of this ManageRelatedRecords page, because I would have to, based on the id of the parent object, obtain different translations to then use in the labels of my importer.
How can I, inside my Importer, get the id of the parent object?
I hope I explained my need well,
Thank you in advance
2 replies
unserialize(): Error at offset 16777211 of 16777215 bytes
Hi everyone, I updated my project to Laravel 11, now when I go to edit my Resource I get the following error:
unserialize(): Error at offset 16777211 of 16777215 bytes (View: /var/www/html/my_project/laravel/vendor/filament/forms/resources/views/components/select.blade.php) (View: /var/www/html/my_project/laravel/vendor/filament/forms/resources/views/components/select.blade.php) (View: /var/www/html/my_project/laravel/vendor/filament/forms/resources/views/components/select.blade.php)
any suggestions?
Thanks in advance
2 replies
Block Repeater Rating with MorphToMany Relation
Greetings,
I have a block with this form inside
class Rating
{
public static function make(
string $name = 'rating',
string $context = 'form',
):Block {
$views = [$view1, $viev2];
return Block::make($name)
->schema([
Select::make('_tpl')
->label('layout')
->options($views),
Repeater::make('ratings')
->relationship()
->schema([
TextInput::make('title')->required(),
ColorPicker::make('color'),
SpatieMediaLibraryFileUpload::make('rating')
->collection('rating'),
])
->reorderableWithButtons()
->reorderableWithDragAndDrop(true)
->columnSpanFull()
->columns(3),
])
// ->reorderableWithButtons()
// ->addActionLabel('Add member')
// ->label('Link to article')
->columns('form' === $context ? 2 : 1);
}
}
used inside my ArticleResource resource, whose model has the relationship
public function ratings(): MorphToMany
{
$pivot_class = RatingMorph::class;
$pivot = app($pivot_class);
$pivot_table = $pivot->getTable();
$pivot_db_name = $pivot->getConnection()->getDatabaseName();
$pivot_table_full = $pivot_db_name.'.'.$pivot_table;
$pivot_fields = $pivot->getFillable();
return $this->morphToMany(Rating::class, 'model', $pivot_table_full)
->using($pivot_class)
->withPivot($pivot_fields)
->withTimestamps();
}
when I do a save, everything is fine, but:
- if I delete a rating, nothing inside the tables is deleted
- if I import data via xls/json, when I view the edit page, the data is not displayed/loaded inside
where am I wrong? any suggestions?
Thanks in advance
2 replies
https://github.com/buildix/timex for V3
Hello everyone, do you know something about the update of this package https://github.com/buildix/timex for version 3 of Filament?
4 replies
Automatic creation of the schema form
Hi everyone,
Is there any way to get the schema form starting from the class name of a resource?
I would like to automatically check the schema form for each resource/model and if empty, insert the various elements automatically
Thanks in advance
2 replies
Method Konnco\FilamentImport\Actions\ImportAction::table does not exist
Hello everyone,
I need to use the ImportAction inside a RelationManager, unfortunately the following error appears:
"Method Konnco\FilamentImport\Actions\ImportAction::table does not exist."
advice?
10 replies
Call to undefined method Modules\MyModule\Filament\Resources\QuestionChartResource::getUrl()
Hello everyone,
inside a RelationManager, in my table, I inserted the following custom action:
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\Action::make('regenImg2')
->label('regenerate2')
->icon('heroicon-o-arrow-path')
->url(fn ($record): string => QuestionChartResource::getUrl('regen-img-2', ['record' => $record, ...self::$route_params])),
])
as per this paragraph,
https://filamentphp.com/docs/3.x/panels/resources/getting-started#generating-urls-to-resource-pages
but it gives me the error
"Call to undefined method Modules\MyModule\Filament\Resources\QuestionChartResource::getUrl()"
suggestions on what I'm doing wrong?
Thanks in advance
5 replies
width of the widget
in my dashboard that extends ListRecords I'm using the getHeaderWidgets function which returns an array
$widgets = [
SurveysSentWidget::make(['stats' => $stats['surveysSent']]),
];
to display a custom widget.
the code of my widget is this
<?php
namespace Modules\MyModule\Filament\Widgets;
use Filament\Forms;
use Filament\Widgets\Widgets;
class SurveysSentWidget extends Widget implements Forms\Contracts\HasForms
{
use Forms\Concerns\InteractsWithForms;
protected static string $view = 'my_module::filament.widgets.stats';
public ?float $tot = null;
public ?float $sms = null;
public ?float $emails = null;
public ?string $title = 'Surveys Posted';
public array $stats;
/**
* @var int | string | array<string, int | null>
*/
protected int|string|array $columnSpan = '2xl';
public function mount(): void
{
$this->tot = $this->stats['tot'][0] ?? 0;
$this->sms = $this->stats['sms'][0] ?? 0;
$this->emails = $this->stats['emails'][0] ?? 0;
}
}
unfortunately, despite having changed the columnSpan property, the widget still does not change its width, always taking half the width of my page.
Where am I doing wrong?
2 replies
old function getTableContent in version 2
https://v2.filamentphp.com/tricks/use-custom-view-for-table-content
in this link there is an example where I can use the getTableContent function
this function gave me the possibility of using a customizable blade, having access to every field of my record....
Unfortunately it is inherent to version 2
was it translated in version 3?
Is there a function/command where I can do the same thing?
Thanks in advance
5 replies