Gandalf
Gandalf
FFilament
Created by zekerzichtbaar on 1/12/2024 in #❓┊help
White screen when in SPA mode
I do occasionally get that on firefox. I think this happens when you navigate between pages quickly, and livewire starts throttling the requests, as previous requests have not been fulfilled yet.
3 replies
FFilament
Created by Gandalf on 9/24/2024 in #❓┊help
Rich editor alignment formatting?
I've used TinyEditor. Thanks!
6 replies
FFilament
Created by Gandalf on 9/24/2024 in #❓┊help
Rich editor alignment formatting?
TipTap editor requires custom theme. I would like to avoid such setup.
6 replies
FFilament
Created by Gandalf on 9/21/2024 in #❓┊help
Using filters in a custom page
Figured it out. Had to override getViewData()
3 replies
FFilament
Created by Gandalf on 9/13/2024 in #❓┊help
Using shadcn/ui for interface
OK, Thanks!
9 replies
FFilament
Created by Gandalf on 9/13/2024 in #❓┊help
Using shadcn/ui for interface
Could you please guide me to where I should start looking at for swapping out individual components?
9 replies
FFilament
Created by Gandalf on 9/13/2024 in #❓┊help
Using shadcn/ui for interface
OK
9 replies
FFilament
Created by Gandalf on 9/13/2024 in #❓┊help
Using shadcn/ui for interface
Got it, and that's why suggesting the alternative Pines UI which is based on alpine and tailwind
9 replies
FFilament
Created by Gandalf on 9/13/2024 in #❓┊help
Using shadcn/ui for interface
Alternatively, Pines UI which is based on shadcn/ui and hence is very similar to it.
9 replies
FFilament
Created by IndomieRendang on 3/30/2023 in #❓┊help
How to get the select option label using $get?
Does the way remain the save in Filament 3.x?
4 replies
FFilament
Created by developer on 6/5/2024 in #❓┊help
same model policy: multiple resources
I think this question was for me. Here is a sample:
abstract class ModelPolicy
{
public static ?string $slug = 'models';

/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->hasPermission(static::$slug . '.index');
}

/**
* Determine whether the user can view the model.
*/
public function view(User $user, Model $model): bool
{
return $user->hasPermission(static::$slug . '.show');
}
abstract class ModelPolicy
{
public static ?string $slug = 'models';

/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->hasPermission(static::$slug . '.index');
}

/**
* Determine whether the user can view the model.
*/
public function view(User $user, Model $model): bool
{
return $user->hasPermission(static::$slug . '.show');
}
and then,
class AccountPolicy extends ModelPolicy
{
public static ?string $slug = 'accounts';

public function setOpeningBalance(User $user): bool
{
return $user->hasPermission('accounts.set-opening-balance');
}
}
class AccountPolicy extends ModelPolicy
{
public static ?string $slug = 'accounts';

public function setOpeningBalance(User $user): bool
{
return $user->hasPermission('accounts.set-opening-balance');
}
}
Here AccountPolicy has inherited all the methods from ModelPolicy with appropriate customizations through static variables. And custom policy method or overrides are specified in the derived policy, such as setOpeningBalance in this case.
13 replies
FFilament
Created by Gandalf on 5/30/2024 in #❓┊help
filament.exports.download giving 404 in multi-database multi-tenancy setup
Finally managed to solve this by copying the following lines in my routes/tenant.php:
Route::get('/filament/exports/{export}/download', DownloadExport::class)
->name('filament.exports.download')
->middleware('filament.actions');
Route::get('/filament/imports/{import}/failed-rows/download', DownloadImportFailureCsv::class)
->name('filament.imports.failed-rows.download')
->middleware('filament.actions');
Route::get('/filament/exports/{export}/download', DownloadExport::class)
->name('filament.exports.download')
->middleware('filament.actions');
Route::get('/filament/imports/{import}/failed-rows/download', DownloadImportFailureCsv::class)
->name('filament.imports.failed-rows.download')
->middleware('filament.actions');
3 replies
FFilament
Created by Gandalf on 6/6/2024 in #❓┊help
Transform record before import to database
Managed to solve it by appending the following code at the end of beforeFill:
if ($this->record) {
$this->record->data = $this->data['data'];
}
if ($this->record) {
$this->record->data = $this->data['data'];
}
3 replies
FFilament
Created by developer on 6/5/2024 in #❓┊help
same model policy: multiple resources
You can extend the policy to create new policies. That's what I do when I've to use polymorphism. Allows me to customize the policy for specific cases.
13 replies
FFilament
Created by Gandalf on 6/3/2024 in #❓┊help
fillForm on Create Page?
I am not explicitly calling save as that shall be done by the action itself
30 replies
FFilament
Created by Gandalf on 6/3/2024 in #❓┊help
fillForm on Create Page?
This works, just made a little change to the beforeReplicaSaved closure as:
->beforeReplicaSaved(function (Model $replica, array $data): void {
$replica->setRawAttributes($data);
}
->beforeReplicaSaved(function (Model $replica, array $data): void {
$replica->setRawAttributes($data);
}
30 replies
FFilament
Created by Gandalf on 6/3/2024 in #❓┊help
fillForm on Create Page?
I will give it a try and report back
30 replies
FFilament
Created by Gandalf on 6/3/2024 in #❓┊help
fillForm on Create Page?
2 things: 1. form(self::form()) doesn't work as self::form requires a from argument. So, I've used form(fn (Form $form) => static::form($form->model(static::$model))->columns(2)) instead 2. It creates a new record with old values, and updated the existing record with new values
30 replies
FFilament
Created by Gandalf on 6/3/2024 in #❓┊help
fillForm on Create Page?
Let me try this and get back
30 replies
FFilament
Created by Gandalf on 6/3/2024 in #❓┊help
fillForm on Create Page?
I believe there will be a couple of more steps required in case of a generic action, such as letting filament know what to do when the form has been filled, via some action buttons. May as well need to create a separate page for this, similar to edit page.
30 replies