David | Fortune Validator
David | Fortune Validator
FFilament
Created by David | Fortune Validator on 12/11/2024 in #❓┊help
RepeaterEntry Action - How to get item data?
as always found the answer after posting. If anyone else needs it though here is answer:
->action(function($arguments, $component){
if($component->getState()->type == 'folder') {
return DropboxController::downloadFolder($component->getState()->path);
} else {
return DropboxController::downloadFile($component->getState()->path);
}
})
->action(function($arguments, $component){
if($component->getState()->type == 'folder') {
return DropboxController::downloadFolder($component->getState()->path);
} else {
return DropboxController::downloadFile($component->getState()->path);
}
})
4 replies
FFilament
Created by WiseWill on 12/2/2024 in #❓┊help
Order of Clusters in Navigation
Try $sort
6 replies
FFilament
Created by David | Fortune Validator on 11/28/2024 in #❓┊help
Group Table By Year
So I have managed the following with looking through a couple of other help posts. Is there a most Filament way of doing this though:
public function table(Table $table): Table
{
return $table
->modifyQueryUsing(fn($query) =>
$query
->selectRaw('ROW_NUMBER() OVER (ORDER BY DATE_FORMAT(date, "%Y")) AS id')
->selectRaw('YEAR(date) as year,SUM(sub_total) as turnover, SUM(profit) as profit,SUM(baProfit) as benProfit,SUM(budgetProfit) as budgetProfit')
->groupByRaw('YEAR(date)') // Group by year
->orderBy('year', 'desc') // Sort by year
)
->groupsOnly()
->columns([
Tables\Columns\TextColumn::make('year')
->label('Year')
->sortable(),
Tables\Columns\TextColumn::make('turnover')->numeric(0)
->sortable(),
Tables\Columns\TextColumn::make('profit')->numeric(0)
->sortable(),
Tables\Columns\TextColumn::make('benProfit')->numeric(0)
->sortable(),
Tables\Columns\TextColumn::make('budgetProfit')->numeric(0)
->sortable(),
]);
}
public function table(Table $table): Table
{
return $table
->modifyQueryUsing(fn($query) =>
$query
->selectRaw('ROW_NUMBER() OVER (ORDER BY DATE_FORMAT(date, "%Y")) AS id')
->selectRaw('YEAR(date) as year,SUM(sub_total) as turnover, SUM(profit) as profit,SUM(baProfit) as benProfit,SUM(budgetProfit) as budgetProfit')
->groupByRaw('YEAR(date)') // Group by year
->orderBy('year', 'desc') // Sort by year
)
->groupsOnly()
->columns([
Tables\Columns\TextColumn::make('year')
->label('Year')
->sortable(),
Tables\Columns\TextColumn::make('turnover')->numeric(0)
->sortable(),
Tables\Columns\TextColumn::make('profit')->numeric(0)
->sortable(),
Tables\Columns\TextColumn::make('benProfit')->numeric(0)
->sortable(),
Tables\Columns\TextColumn::make('budgetProfit')->numeric(0)
->sortable(),
]);
}
3 replies
FFilament
Created by Arlind Musliu on 1/5/2024 in #❓┊help
Group by date and summarize number of pages
Hi, I hope you dont mind me jumping on this: I wanted to group by Year only.
public function table(Table $table): Table
{
return $table->query(
Invoice::query()
->groupByRaw('DATE_FORMAT(date, "%Y")')
->selectRaw('ROW_NUMBER() OVER (ORDER BY DATE_FORMAT(date, "%Y")) AS id')
->selectRaw('DATE_FORMAT(date, "%Y") as date, SUM(profit) as pages')
->orderBy('date', 'desc')
->where('client_id', $this->getOwnerRecord()->id)
->limit(10)
)
->columns([
Tables\Columns\TextColumn::make('date')
->label('Year')
->date('Y'),
Tables\Columns\TextColumn::make('pages')
->label('Pages Read'),
])
->groupsOnly();


}
public function table(Table $table): Table
{
return $table->query(
Invoice::query()
->groupByRaw('DATE_FORMAT(date, "%Y")')
->selectRaw('ROW_NUMBER() OVER (ORDER BY DATE_FORMAT(date, "%Y")) AS id')
->selectRaw('DATE_FORMAT(date, "%Y") as date, SUM(profit) as pages')
->orderBy('date', 'desc')
->where('client_id', $this->getOwnerRecord()->id)
->limit(10)
)
->columns([
Tables\Columns\TextColumn::make('date')
->label('Year')
->date('Y'),
Tables\Columns\TextColumn::make('pages')
->label('Pages Read'),
])
->groupsOnly();


}
the sum works but the date column shows the same year in each row. any ideas?
3 replies
FFilament
Created by jop00 on 9/20/2023 in #❓┊help
Group table by year
a year late but didnt anyone figure this out?
8 replies
FFilament
Created by David | Fortune Validator on 11/23/2024 in #❓┊help
Infolist data from Form textarea
I’ll give this a whirl, thank you
6 replies
FFilament
Created by David | Fortune Validator on 11/23/2024 in #❓┊help
Infolist data from Form textarea
I did try that but it didn’t give me the line breaks
6 replies
FFilament
Created by thedangler on 11/9/2024 in #❓┊help
Custom Page canAccess runs after mount ?
did you get anywhere with this? Noticing the same. I would also like to access the record within the canAccess but didnt find a way
5 replies
FFilament
Created by morty on 8/16/2024 in #❓┊help
Is there a more succinct way of retrieving a count of a resource inside a `ManageRelatedRecords`?
shame. Try that snippet above. I tried yours but the it was failing when I added a record. Try my code, seems okay for me
9 replies
FFilament
Created by morty on 8/16/2024 in #❓┊help
Is there a more succinct way of retrieving a count of a resource inside a `ManageRelatedRecords`?
I went with this:
public static function getNavigationBadge(): ?string
{
$count = static::getResource()::getModel()::find(request()->route('record'))?->notes->count();
if($count > 0){
return $count;
}
return null;
}
public static function getNavigationBadge(): ?string
{
$count = static::getResource()::getModel()::find(request()->route('record'))?->notes->count();
if($count > 0){
return $count;
}
return null;
}
9 replies
FFilament
Created by morty on 8/16/2024 in #❓┊help
Is there a more succinct way of retrieving a count of a resource inside a `ManageRelatedRecords`?
did you ever get a solution for this? I am struggling to gain access to the parent record as well
9 replies
FFilament
Created by David | Fortune Validator on 11/8/2024 in #❓┊help
Custom Pages By User
I think I always thought of Resources as list/edit/view only but it worked quite well with this use case also.
10 replies
FFilament
Created by David | Fortune Validator on 11/8/2024 in #❓┊help
Custom Pages By User
I used the resolve record so I could pass the user across each page which worked nicely
10 replies
FFilament
Created by David | Fortune Validator on 11/8/2024 in #❓┊help
Custom Pages By User
thanks for coming back to me. no its quite complex data / tables so it doesnt really fit the generic. I ended up goign with a resource to list the users and modify the query to show all users for admins and only single user for standard. then created custom pages for the resource and added the livewire components as you mentioned
10 replies
FFilament
Created by David | Fortune Validator on 11/8/2024 in #❓┊help
Custom Pages By User
Should I create another resource , maybe with maybe some custom pages ? And resolve the record. Then do custom logic for the report ?
10 replies
FFilament
Created by David | Fortune Validator on 10/11/2024 in #❓┊help
SUB_NAVIGATION Hook
https://github.com/filamentphp/filament/pull/14566 Hopefully Ive done it correctly. My first PR ever
11 replies
FFilament
Created by David | Fortune Validator on 10/11/2024 in #❓┊help
SUB_NAVIGATION Hook
I've found the file. Just need to work out how to create a hook
11 replies
FFilament
Created by David | Fortune Validator on 10/11/2024 in #❓┊help
SUB_NAVIGATION Hook
which a hook would be perfect for
11 replies
FFilament
Created by David | Fortune Validator on 10/11/2024 in #❓┊help
SUB_NAVIGATION Hook
I did go down this route to add some nav links but I would like to add a whole livewire component underneath the sub nav
11 replies
FFilament
Created by David | Fortune Validator on 10/11/2024 in #❓┊help
SUB_NAVIGATION Hook
anyone have any ideas?
11 replies