Patrick
Patrick
FFilament
Created by jjo63 on 10/22/2024 in #❓┊help
Adding a record count alongside a navigation link
If you take a peek into the Resource class itself, you'll find a lot of public methods that you can use
10 replies
FFilament
Created by jjo63 on 10/22/2024 in #❓┊help
Adding a record count alongside a navigation link
No description
10 replies
FFilament
Created by jjo63 on 10/22/2024 in #❓┊help
Adding a record count alongside a navigation link
public static function getNavigationBadge(): ?string
{
return 420;
}
public static function getNavigationBadge(): ?string
{
return 420;
}
This in your resource class if i'm correct
10 replies
FFilament
Created by toeknee on 10/3/2024 in #❓┊help
wireclick to chart points
A wire:click that emits an event, and the table listens for that event?
3 replies
FFilament
Created by jepewsykes on 10/3/2024 in #❓┊help
Ask Database transaction
so yes, it is wrapped in a transaction
6 replies
FFilament
Created by jepewsykes on 10/3/2024 in #❓┊help
Ask Database transaction
public function create(bool $another = false): void
{
$this->authorizeAccess();

try {
$this->beginDatabaseTransaction();

$this->callHook('beforeValidate');

$data = $this->form->getState();

$this->callHook('afterValidate');

$data = $this->mutateFormDataBeforeCreate($data);

$this->callHook('beforeCreate');

$this->record = $this->handleRecordCreation($data);

$this->form->model($this->getRecord())->saveRelationships();

$this->callHook('afterCreate');

$this->commitDatabaseTransaction();
} catch (Halt $exception) {
$exception->shouldRollbackDatabaseTransaction() ?
$this->rollBackDatabaseTransaction() :
$this->commitDatabaseTransaction();

return;
} catch (Throwable $exception) {
$this->rollBackDatabaseTransaction();

throw $exception;
}

$this->rememberData();

$this->getCreatedNotification()?->send();

if ($another) {
// Ensure that the form record is anonymized so that relationships aren't loaded.
$this->form->model($this->getRecord()::class);
$this->record = null;

$this->fillForm();

return;
}

$redirectUrl = $this->getRedirectUrl();

$this->redirect($redirectUrl, navigate: FilamentView::hasSpaMode() && is_app_url($redirectUrl));
}
public function create(bool $another = false): void
{
$this->authorizeAccess();

try {
$this->beginDatabaseTransaction();

$this->callHook('beforeValidate');

$data = $this->form->getState();

$this->callHook('afterValidate');

$data = $this->mutateFormDataBeforeCreate($data);

$this->callHook('beforeCreate');

$this->record = $this->handleRecordCreation($data);

$this->form->model($this->getRecord())->saveRelationships();

$this->callHook('afterCreate');

$this->commitDatabaseTransaction();
} catch (Halt $exception) {
$exception->shouldRollbackDatabaseTransaction() ?
$this->rollBackDatabaseTransaction() :
$this->commitDatabaseTransaction();

return;
} catch (Throwable $exception) {
$this->rollBackDatabaseTransaction();

throw $exception;
}

$this->rememberData();

$this->getCreatedNotification()?->send();

if ($another) {
// Ensure that the form record is anonymized so that relationships aren't loaded.
$this->form->model($this->getRecord()::class);
$this->record = null;

$this->fillForm();

return;
}

$redirectUrl = $this->getRedirectUrl();

$this->redirect($redirectUrl, navigate: FilamentView::hasSpaMode() && is_app_url($redirectUrl));
}
6 replies
FFilament
Created by jepewsykes on 10/3/2024 in #❓┊help
Ask Database transaction
If you take a peek in CreateRecord
6 replies
FFilament
Created by y_e_v_h_e_n_i_i on 10/1/2024 in #❓┊help
Using tabs not repeater for dynamic form
Forms\Components\Tabs::make('localizations_tabs')
->tabs(function () {
$tabs = [];
$localizations = $this->record->localizations;

foreach ($localizations as $index => $localization) {
$tabs[] = Forms\Components\Tabs\Tab::make($localization->locale)
->schema([
Forms\Components\TextInput::make("localizations.{$localization->id}.locale")
->label('Locale')
->default($localization->locale)
->required(),
Forms\Components\TextInput::make("localizations.{$localization->id}.title")
->label('Title')
->default($localization->title)
->required(),
Forms\Components\RichEditor::make("localizations.{$localization->id}.body")
->label('Body')
->default($localization->body)
->required(),
]);

return $tabs;
}
})
->columnSpanFull()
Forms\Components\Tabs::make('localizations_tabs')
->tabs(function () {
$tabs = [];
$localizations = $this->record->localizations;

foreach ($localizations as $index => $localization) {
$tabs[] = Forms\Components\Tabs\Tab::make($localization->locale)
->schema([
Forms\Components\TextInput::make("localizations.{$localization->id}.locale")
->label('Locale')
->default($localization->locale)
->required(),
Forms\Components\TextInput::make("localizations.{$localization->id}.title")
->label('Title')
->default($localization->title)
->required(),
Forms\Components\RichEditor::make("localizations.{$localization->id}.body")
->label('Body')
->default($localization->body)
->required(),
]);

return $tabs;
}
})
->columnSpanFull()
like this
8 replies
FFilament
Created by y_e_v_h_e_n_i_i on 10/1/2024 in #❓┊help
Using tabs not repeater for dynamic form
at a glance, don't you have to return the $tabs ?
8 replies
FFilament
Created by Patrick on 9/11/2024 in #❓┊help
FBlog won't save post when TiptipEditor output is set to JSON.
thans for the reply!
8 replies
FFilament
Created by Patrick on 9/11/2024 in #❓┊help
FBlog won't save post when TiptipEditor output is set to JSON.
yea i thought so, i do wonder why overriding the casts on runtime does not work
8 replies
FFilament
Created by Patrick on 9/11/2024 in #❓┊help
FBlog won't save post when TiptipEditor output is set to JSON.
I tried addin this to my AppServiceProvider:
if(config('filament-tiptap-editor.output') === TiptapOutput::Json){
Event::listen('eloquent.booting: Firefly\FilamentBlog\Models\Post', function (Post $post) {
$post->mergeCasts([
'body' => 'array'
]);
});
};
if(config('filament-tiptap-editor.output') === TiptapOutput::Json){
Event::listen('eloquent.booting: Firefly\FilamentBlog\Models\Post', function (Post $post) {
$post->mergeCasts([
'body' => 'array'
]);
});
};
It adds it to the casts array but does not resolve the issue
8 replies
FFilament
Created by Patrick on 9/11/2024 in #❓┊help
FBlog won't save post when TiptipEditor output is set to JSON.
could cast the body to an array if a tiptap output in config is set to json, just have to find out how to do this 😄
8 replies
FFilament
Created by Patrick on 9/11/2024 in #❓┊help
FBlog won't save post when TiptipEditor output is set to JSON.
Is it possible to change the $casts array via a model event? Like when it's booted for example
8 replies
FFilament
Created by Patrick on 6/21/2024 in #❓┊help
Can not add table to a component
Found it, used the wrong
HasTable
HasTable
trait. The correct one is
use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Contracts\HasTable;
4 replies
FFilament
Created by kian on 5/7/2024 in #❓┊help
Creating redirects from old pages to new ones
another option is just to use the .htaccess file if you use apache
7 replies
FFilament
Created by tyler on 4/5/2024 in #❓┊help
hi
hi
16 replies
FFilament
Created by Amir Khan on 4/4/2024 in #❓┊help
419 Page Expired Popup
you can increase its lifetime in config/session.php
23 replies
FFilament
Created by Amir Khan on 4/4/2024 in #❓┊help
419 Page Expired Popup
ooh if u dont do anything with the app the session will expire
23 replies
FFilament
Created by Amir Khan on 4/4/2024 in #❓┊help
419 Page Expired Popup
do you have it all the time that 419? maybe the session domain is wrong
23 replies