Panda
Panda
FFilament
Created by Panda on 7/23/2024 in #❓┊help
How to edit resource properties on simple resource creation?
Thanks, got it!
4 replies
FFilament
Created by Panda on 11/1/2023 in #❓┊help
How to add custom (non-stat, non-chart) widget in dashboard?
Thanks, it did the work. I added the content and elements in blade view.
5 replies
FFilament
Created by Panda on 10/11/2023 in #❓┊help
SPA mode crashing styles when navigating to non Filament routes
When I disable the SPA mode it works fine.
2 replies
FFilament
Created by Panda on 9/15/2023 in #❓┊help
Passing parent model to a child resource's create page
Yup, I'll be passing the IDs as route parameters but don't know how to define them.
3 replies
FFilament
Created by MKD on 9/15/2023 in #❓┊help
Is it possible to add resources inside a new folder ?
Is your issue resolved?
13 replies
FFilament
Created by MKD on 9/15/2023 in #❓┊help
Is it possible to add resources inside a new folder ?
Check if you've added either the $shouldRegisterNavigation property or the shouldRegisterNavigation method on your resource class. If either of them is returning false then it will render in navigation.
13 replies
FFilament
Created by MKD on 9/15/2023 in #❓┊help
Is it possible to add resources inside a new folder ?
If you've already created resources then you can move them into a sub-namespace folder and adjust the namespace of your resource, relation managers, and pages. Also, remember to edit the imports in your pages and relation manager.
13 replies
FFilament
Created by MKD on 9/15/2023 in #❓┊help
Is it possible to add resources inside a new folder ?
Yes you can, when creating resources you can prefix them, and it will create a sub-namespace. Consider the following command.
artisan make:filament-resource Billing/Transaction
artisan make:filament-resource Billing/Transaction
13 replies
FFilament
Created by Finn on 9/15/2023 in #❓┊help
Section of fields that I can re-use over multiple resources/custom pages
PS: I'm not familiar with Livewire and component stuff but if there's a better approach like a custom component then you should go with that.
6 replies
FFilament
Created by Finn on 9/15/2023 in #❓┊help
Section of fields that I can re-use over multiple resources/custom pages
You can define them on a resource or on a separate class as a static method. I've used a similar method in a resource class where I created a custom delete action which I needed in two places. I added the following code in my CoinsPackResource class as I was re-using this only in the same resource but you can create a separate class somewhere else and define your custom methods on it.
/**
* Custom delete action for applying pre-deletion checks.
*
* @param \Filament\Actions\DeleteAction $action
* @param \App\Models\Billing\CoinsPack $coinsPack
* @return \Filament\Actions\DeleteAction
*/
public static function customDeleteAction(): DeleteAction
{
return DeleteAction::make()
->before(function (DeleteAction $action, CoinsPack $coinsPack) {
// Make sure there are no pending transactions for this resource
// or else an exception will be thrown
if ($coinsPack->transactions()->pending()->exists()) {
Notification::make()
->warning()
->title('Cannot delete this record')
->body('Please wait till pending transactions are processed')
->danger()
->persistent()
->send();

$action->cancel();
}
});
}
/**
* Custom delete action for applying pre-deletion checks.
*
* @param \Filament\Actions\DeleteAction $action
* @param \App\Models\Billing\CoinsPack $coinsPack
* @return \Filament\Actions\DeleteAction
*/
public static function customDeleteAction(): DeleteAction
{
return DeleteAction::make()
->before(function (DeleteAction $action, CoinsPack $coinsPack) {
// Make sure there are no pending transactions for this resource
// or else an exception will be thrown
if ($coinsPack->transactions()->pending()->exists()) {
Notification::make()
->warning()
->title('Cannot delete this record')
->body('Please wait till pending transactions are processed')
->danger()
->persistent()
->send();

$action->cancel();
}
});
}
6 replies
FFilament
Created by HiJoe on 9/15/2023 in #❓┊help
New instantly creates a new record
This is because you have not defined anything in your form method. Either define fields in the form builder or disable the create button.
5 replies
FFilament
Created by Daniel Reales on 9/14/2023 in #❓┊help
Send email after register user
You can pass the same parameters to this method. The definition is similar to Filament::getResetPasswordUrl.
public function getResetPasswordUrl(string $token, CanResetPassword | Model | Authenticatable $user, array $parameters = []): string
{}
public function getResetPasswordUrl(string $token, CanResetPassword | Model | Authenticatable $user, array $parameters = []): string
{}
21 replies
FFilament
Created by Daniel Reales on 9/14/2023 in #❓┊help
Send email after register user
I've not used it but digging into the code got me the following snippet. Check if it meets your needs or was it a dumb call.
Filament::getPanel('admin')->getResetPasswordUrl()
Filament::getPanel('admin')->getResetPasswordUrl()
21 replies
FFilament
Created by Panda on 9/14/2023 in #❓┊help
Is it possible to disable the resource index page?
Fixed it! The index page URL is generated in the following places. 1. Sidebar navigation 2. Cancel button on edit page (not using edit page) 3. Breadcrumbs Since I'm not registering the resource in navigation the only thing that was giving me trouble was the breadcrumbs which after a deep dive into the Filament resource pages code I ended up overriding the getBreadcrumbs method on the ViewSeries page. I replaced the link to the index page with the view page of my parent/owner resource. This is my implementation in the SeriesResource/Pages/ViewSeries class.
/**
* {@inheritdoc}
*/
public function getBreadcrumbs(): array
{
// The parent model, loaded through the `novel` relationship
$baseUrl = route('filament.admin.resources.content.novels.view', [
'record' => $this->getRecord()->novel
]);

/**
* All procedure below is copied from the base `Page` class.
* @see \Filament\Resources\Pages\Page@getBreadcrumbs
*/
$resource = static::getResource();
$breadcrumb = $this->getBreadcrumb();

return [
$baseUrl => 'Novel',
$resource::getBreadcrumb(),
...(filled($breadcrumb) ? [$breadcrumb] : []),
];
}
/**
* {@inheritdoc}
*/
public function getBreadcrumbs(): array
{
// The parent model, loaded through the `novel` relationship
$baseUrl = route('filament.admin.resources.content.novels.view', [
'record' => $this->getRecord()->novel
]);

/**
* All procedure below is copied from the base `Page` class.
* @see \Filament\Resources\Pages\Page@getBreadcrumbs
*/
$resource = static::getResource();
$breadcrumb = $this->getBreadcrumb();

return [
$baseUrl => 'Novel',
$resource::getBreadcrumb(),
...(filled($breadcrumb) ? [$breadcrumb] : []),
];
}
7 replies
FFilament
Created by Panda on 9/14/2023 in #❓┊help
Is it possible to disable the resource index page?
I solved the issue in my other using similar approach and I'll post it here as well.
7 replies
FFilament
Created by Panda on 9/15/2023 in #❓┊help
How to delete [index] resource page?
Fixed it! The index page URL is generated in the following places. 1. Sidebar navigation 2. Cancel button on edit page (not using edit page) 3. Breadcrumbs Since I'm not registering the resource in navigation the only thing that was giving me trouble was the breadcrumbs which after a deep dive into the Filament resource pages code I ended up overriding the getBreadcrumbs method on the ViewSeries page. I replaced the link to the index page with the view page of my parent/owner resource. This is my implementation in the SeriesResource/Pages/ViewSeries class.
/**
* {@inheritdoc}
*/
public function getBreadcrumbs(): array
{
// The parent model, loaded through the `novel` relationship
$baseUrl = route('filament.admin.resources.content.novels.view', [
'record' => $this->getRecord()->novel
]);

/**
* All procedure below is copied from the base `Page` class.
* @see \Filament\Resources\Pages\Page@getBreadcrumbs
*/
$resource = static::getResource();
$breadcrumb = $this->getBreadcrumb();

return [
$baseUrl => 'Novel',
$resource::getBreadcrumb(),
...(filled($breadcrumb) ? [$breadcrumb] : []),
];
}
/**
* {@inheritdoc}
*/
public function getBreadcrumbs(): array
{
// The parent model, loaded through the `novel` relationship
$baseUrl = route('filament.admin.resources.content.novels.view', [
'record' => $this->getRecord()->novel
]);

/**
* All procedure below is copied from the base `Page` class.
* @see \Filament\Resources\Pages\Page@getBreadcrumbs
*/
$resource = static::getResource();
$breadcrumb = $this->getBreadcrumb();

return [
$baseUrl => 'Novel',
$resource::getBreadcrumb(),
...(filled($breadcrumb) ? [$breadcrumb] : []),
];
}
6 replies
FFilament
Created by haritz on 9/15/2023 in #❓┊help
Login without password
For that, you would need to implement custom functionality to store user session (card) and determine whether to show the pin entry or email/password fields. If you need more control you can swap the default Filament auth middleware with your custom implementation and also pass the controller action to the login chained method in AdminPanelProvider. I've not personally used it but you can test this plugin https://filamentphp.com/plugins/marjose123-lockscreen
6 replies
FFilament
Created by GeRaged | Niklas on 9/15/2023 in #❓┊help
Use Icons
Did you install the Tabler Icon pack? If not, you can do so by running composer require ryangjchandler/blade-tabler-icons
2 replies
FFilament
Created by Panda on 9/14/2023 in #❓┊help
Is it possible to modify the aggregation column query?
I ended up defining a new successfulTransactions relation on the CoinPack and summing through it.
7 replies
FFilament
Created by Panda on 9/14/2023 in #❓┊help
Is it possible to modify the aggregation column query?
No description
7 replies