Panda
Panda
FFilament
Created by Panda on 5/2/2024 in #❓┊help
Discovering resources and pages in custom modules
I'm working on a project which divides each feature into modules like user module, post module, etc. I want to place my Filament resources and pages under relevant module's directories like modules/User/app/Filament and modules/Post/app/Filament etc. Is it possible to do so, and if yes then how can I do this? Any guidance would be much appreciated.
1 replies
FFilament
Created by Panda on 3/30/2024 in #❓┊help
Get URL for record in relation manager
Is it possible to generate URL for relation manager item? I have a shop resource which has a shop items relation manager. I'm showing the name of purchased item in order resource's table and want to add a link to the shop item.
2 replies
FFilament
Created by Panda on 2/27/2024 in #❓┊help
Place resources other than App\Filament\Resources
I was watching the Modular Laravel series on Laracasts and want to move my resources into their relevant modules. Is there any option in Filament to achieve this architecture?
3 replies
FFilament
Created by Panda on 2/26/2024 in #❓┊help
Updating input after saving the form
No description
1 replies
FFilament
Created by Panda on 11/25/2023 in #❓┊help
Updating record via modal footer action
No description
1 replies
FFilament
Created by Panda on 11/1/2023 in #❓┊help
Table custom re-ordering
No description
1 replies
FFilament
Created by Panda on 11/1/2023 in #❓┊help
Adding custom text in infolist
Is it possible to add custom text in infolist? I've seen the TextEntry component but unlike the Placeholder field for Form builder it does not have any methods for setting custom content.
2 replies
FFilament
Created by Panda on 11/1/2023 in #❓┊help
How to add custom (non-stat, non-chart) widget in dashboard?
Hi, I've recently updated the privacy and terms content in my site and I want to show an alert banner with a custom action button in dashboard for non-admin users. I've seen the Filament documentation but there are examples of stat and chart widgets only. Can anyone please guide me on how to add such a widget/element on dashboard?
5 replies
FFilament
Created by Panda on 10/11/2023 in #❓┊help
SPA mode crashing styles when navigating to non Filament routes
I've created a custom navigation like using the following snippet but when I click on it my site's styles are totally ruined (I'm using TailwindCSS) and when I navigate back to the dashboard it also gives issues. Even the open in new tab dosen't work when using SPA mode.
navigationItems([
NavigationItem::make('Main Site')
->url(url(RouteServiceProvider::HOME), shouldOpenInNewTab: true)
->icon('icon-logo')
->sort(1)
])
navigationItems([
NavigationItem::make('Main Site')
->url(url(RouteServiceProvider::HOME), shouldOpenInNewTab: true)
->icon('icon-logo')
->sort(1)
])
2 replies
FFilament
Created by Panda on 9/16/2023 in #❓┊help
Custom properties on Create Page causes 404
I'm passing the parent ID as route parameter and want to save it into a custom property named $series on the page but when I define the property on the CreatePage component it triggers a 404 error, when removed it works fine. So, I cannot define custom livewire state on my page or am I missing something?
<?php

namespace App\Filament\Resources\Content\ChapterResource\Pages;

use App\Filament\Resources\Content\ChapterResource;
use App\Models\Content\Series;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\Routing\Exceptions\UrlGenerationException;

class CreateChapter extends CreateRecord
{
protected static string $resource = ChapterResource::class;

// THE FOLLOWING LINE GIVES 404 ERROR, WHEN REMOVED THE PAGE LOADS
public ?Series $series = null;

public function mount(): void
{
$series_id = request()->route('series');

if (!$series_id || !is_numeric($series_id))
throw new UrlGenerationException('Invalid series provided!');

dd($series_id);

$this->series = Series::findOrFail($series_id);

parent::mount();
}

/**
* {@inheritdoc}
*/
public function getBreadcrumbs(): array
{
return [];
}

protected function mutateFormDataBeforeCreate(array $data): array
{
dd($this->series);

$data['series_id'] = $this->series->id;

return $data;
}
}
<?php

namespace App\Filament\Resources\Content\ChapterResource\Pages;

use App\Filament\Resources\Content\ChapterResource;
use App\Models\Content\Series;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\Routing\Exceptions\UrlGenerationException;

class CreateChapter extends CreateRecord
{
protected static string $resource = ChapterResource::class;

// THE FOLLOWING LINE GIVES 404 ERROR, WHEN REMOVED THE PAGE LOADS
public ?Series $series = null;

public function mount(): void
{
$series_id = request()->route('series');

if (!$series_id || !is_numeric($series_id))
throw new UrlGenerationException('Invalid series provided!');

dd($series_id);

$this->series = Series::findOrFail($series_id);

parent::mount();
}

/**
* {@inheritdoc}
*/
public function getBreadcrumbs(): array
{
return [];
}

protected function mutateFormDataBeforeCreate(array $data): array
{
dd($this->series);

$data['series_id'] = $this->series->id;

return $data;
}
}
1 replies
FFilament
Created by Panda on 9/15/2023 in #❓┊help
Passing parent model to a child resource's create page
I have a SeriesResource with a ChapterRelationManager and I want to create chapters in that series but the chapter has too many fields and I want a separate page for creating and editing chapter that's why I created a ChapterResource. I can easily link the create and edit button on ChapterRelationManager table to ChapterResource's create and edit pages but I'm having trouble passing the Series to the create page of ChapterResource as the Chapter belongs to a Series and I must need the series record in order to create the chapter. Any help would be appreciated.
3 replies
FFilament
Created by Panda on 9/15/2023 in #❓┊help
How to delete [index] resource page?
I have a resource named SeriesResource for which I only want the view page as create and edit operations are handled via parent's ResourceManager. When I remove the index entry from the getPages of the resource, it throws the following error.
Route [filament.admin.resources.content.series.index] not defined.
Route [filament.admin.resources.content.series.index] not defined.
Following is the code for my SeriesResource
public static function getPages(): array
{
return [
// Commenting the index page throws an exception
// 'index' => Pages\ListSeries::route('/'),
// 'create' => Pages\CreateSeries::route('/create'),
'view' => Pages\ViewSeries::route('/{record}'),
// 'edit' => Pages\EditSeries::route('/{record}/edit'),
];
}
public static function getPages(): array
{
return [
// Commenting the index page throws an exception
// 'index' => Pages\ListSeries::route('/'),
// 'create' => Pages\CreateSeries::route('/create'),
'view' => Pages\ViewSeries::route('/{record}'),
// 'edit' => Pages\EditSeries::route('/{record}/edit'),
];
}
6 replies
FFilament
Created by Panda on 9/14/2023 in #❓┊help
Is it possible to modify the aggregation column query?
I am currently loading the sum of amount field from transactions relation on my CoinsPack model using the following code. The Transaction has a status field which can be either pending, cancelled and successful and I want the sum of amount column for only successful transactions.
Tables\Columns\TextColumn::make('transactions_sum_amount')
->sum('transactions', 'amount')
->money('USD')
->label('Sales')
->placeholder('No sales'),
Tables\Columns\TextColumn::make('transactions_sum_amount')
->sum('transactions', 'amount')
->money('USD')
->label('Sales')
->placeholder('No sales'),
7 replies
FFilament
Created by Panda on 9/14/2023 in #❓┊help
Actions on RelationManager not showing even after disabling policies
No description
4 replies
FFilament
Created by Panda on 9/14/2023 in #❓┊help
Is it possible to disable the resource index page?
I am working on a novel reading app where a novel can have many series and a series can have many chapters. I've structured my app in the following way. 1. The NovelResource has a relation manager with Series where I've only added a custom view action which redirects the user to filament.admin.resources.series.view route when clicked and passes the model ID as route parameter. 2. I've created a SeriesResource with only view and edit page and removed the create and index entries from the getPages function in SeriesResource. I've also hidden the resource from navigation by setting $shouldRegisterNavigation to false on the SeriesResource 3. When user is redirected to the series view page (filament.admin.resources.series.view) it throws an error saying the route filament.admin.resources.series.index is not defined. I do not want this page to be created or accessible by anyone because user will list the Series via NovelResource's SeriesRelationManager and cannot directly access the main page. 4. How can I completely disable the index route for SeriesResource? I know it uses the index page link in breadcrumb and the Cancel button but I want to change it to the parent novel page. Any help would be much appreciated.
7 replies