David | Fortune Validator
David | Fortune Validator
FFilament
Created by David | Fortune Validator on 7/1/2024 in #❓┊help
Open Table Heading Model Action by URL
Hi all I have the need whereby when I open a URL with a specific paramter that the model would open with the Create Form inside it. I'm sure I read something like this is possible in the docs but I cannot find it again...
21 replies
FFilament
Created by David | Fortune Validator on 7/1/2024 in #❓┊help
Focus another select after change
Hi all I have the need for the focus to change automatically. Eg I have company name select with autofocus on page load using ->autofocus(). After the company is selected I need it to auto focus onto the next select for 'product type'. Does anyone know how to achieve this? FYI: I am using a form on a custom livewire page. thanks all
5 replies
FFilament
Created by David | Fortune Validator on 6/26/2024 in #❓┊help
Best method to order?
Hi all, I need to add a custom sort/order on my panel table. In short I need to order by more than just the one column. I wanted to check I am doing this the right way? or if there is a better method?
return $table
->modifyQueryUsing(fn (Builder $query) => $query->orderByRaw("date DESC, time DESC"))
return $table
->modifyQueryUsing(fn (Builder $query) => $query->orderByRaw("date DESC, time DESC"))
6 replies
FFilament
Created by David | Fortune Validator on 6/21/2024 in #❓┊help
Form Components only for on form actions
Hi all Is there a way to have some components, eg Toggle to be solely for the use of form actions and not to save to the database. E.g show / hide portions of the form based off the toggle but the toggle name has no database column. Edit: Using a 'Adding a form to a Livewire component', not Panel. Many thanks.
4 replies
FFilament
Created by David | Fortune Validator on 6/20/2024 in #❓┊help
Summary on custom state
I have an invoices table which shows the Sub Total and the Profit per row. I have a custom column which shows the GP% and Markup% using a state(). I am wanting to have in the summary the overall percentage e.g (profit/Subtotal)*100 of all rows. I cannot for the life of my work out how to go about this one. Any help would be appreciated. Thank you.
9 replies
FFilament
Created by David | Fortune Validator on 2/22/2024 in #❓┊help
Filter On Load Or URL
Hi all I hope someone can help. I have a table in a livewire component ( not panel ). I have a link on another page which directs to this table page and modifies the query:
>modifyQueryUsing(function (Builder $query) {

// If client_id is in the GET
if (request()->filled('client_id')) {
$query->where('client_id', request()->input('client_id'));
}
}
>modifyQueryUsing(function (Builder $query) {

// If client_id is in the GET
if (request()->filled('client_id')) {
$query->where('client_id', request()->input('client_id'));
}
}
Howver when I click on the next page in the pagination it is lost. So I wondered if there a way to save this? OR Have a filter (client drop down) be selected on page load).
11 replies
FFilament
Created by David | Fortune Validator on 2/12/2024 in #❓┊help
Table ->groupsOnly() Heading UI Issue
I think I found a bug when using the ->groupsOnly() on a table. Code below and picture to following. The first column ( group identifier ) is not adding a header to the table and everything shunts to the left.
return $table
->query(Invoice::query()
->when(
Invoice::has('client'),
function ($query) {
$query->whereHas('client', function ($query) {
$query->where('origin', 'internet');
});
}
)
->where('date', '>=', Carbon::now()->subYear()->format('Y-m-d'))
)
->defaultGroup('client.company_name')
->groupsOnly()
->columns([
Tables\Columns\TextColumn::make('sub_total')->summarize(Sum::make()->label('Sub Total')),
Tables\Columns\TextColumn::make('budgetProfit')->summarize(Sum::make()->label('Budget Profit')),
Tables\Columns\TextColumn::make('profit')->summarize(Sum::make()->label('Profit')),
]);
return $table
->query(Invoice::query()
->when(
Invoice::has('client'),
function ($query) {
$query->whereHas('client', function ($query) {
$query->where('origin', 'internet');
});
}
)
->where('date', '>=', Carbon::now()->subYear()->format('Y-m-d'))
)
->defaultGroup('client.company_name')
->groupsOnly()
->columns([
Tables\Columns\TextColumn::make('sub_total')->summarize(Sum::make()->label('Sub Total')),
Tables\Columns\TextColumn::make('budgetProfit')->summarize(Sum::make()->label('Budget Profit')),
Tables\Columns\TextColumn::make('profit')->summarize(Sum::make()->label('Profit')),
]);
3 replies
FFilament
Created by David | Fortune Validator on 2/6/2024 in #❓┊help
I need to access $record on Table Action form
I have the following. In relation to the invoiceReadyValue form field. this is a value already stored on the record but I want the ability to edit this field and then save it. I may have a few forms for different actions on the table row. I cannot work out how to prefil the value into the form entry though, its blank but there is a value stored. Any ideas? Thanks all.
->actions([
ActionGroup::make([
Action::make('Toggle Supplier Order')
->requiresConfirmation()
->action(fn (docket $record) => $record->update(['docProgSupplierOrder'=> !$record->docProgSupplierOrder ])),
Action::make('Submit For Invoicing')
->accessSelectedRecords()
->form([
TextInput::make('invoiceReadyValue')->required(),
])
->action(function (array $data, docket $record): void {
$record->invoiceReadyValue = $data['invoiceReadyValue'];
$record->save();
Notification::make()
->title('Invoice Submitted')
->success()
->send();
})
])
->actions([
ActionGroup::make([
Action::make('Toggle Supplier Order')
->requiresConfirmation()
->action(fn (docket $record) => $record->update(['docProgSupplierOrder'=> !$record->docProgSupplierOrder ])),
Action::make('Submit For Invoicing')
->accessSelectedRecords()
->form([
TextInput::make('invoiceReadyValue')->required(),
])
->action(function (array $data, docket $record): void {
$record->invoiceReadyValue = $data['invoiceReadyValue'];
$record->save();
Notification::make()
->title('Invoice Submitted')
->success()
->send();
})
])
17 replies
FFilament
Created by David | Fortune Validator on 2/3/2024 in #❓┊help
Not standard group table
Hi all I want to have a table which groups all supplier invoices. Each row is to be a sum of all invoices due on that date and by each specific supplier. Eg: Row1: SupplierA | 12th Jan | 16 invoices | £20,456 Row2: SupplierB | 12th Jan | 1 invoices | £7,456 Row3: SupplierC | 15th Jan | 3 invoices | £2,456 I can’t find out how to get this kind of query on to a table in a panel. Thanks
4 replies
FFilament
Created by David | Fortune Validator on 2/1/2024 in #❓┊help
Standalone Form
Hi all Sorry to trouble everyone but Im struggling with saving data from a standalone form ( not panels ). I am saving the data using this
$this->supplierInvoice->update($this->form->getState());
$this->supplierInvoice->update($this->form->getState());
Howver I want to manipulate the 'budget' column to be 1 based on another condition. I cannot work out how to change the data and it be saved using the above. I tried this:
if($this->data['ourRefArray'] == null)
{
$this->data['budget'] = 1;
}
if($this->data['ourRefArray'] == null)
{
$this->data['budget'] = 1;
}
but it ignores the change. Am I missing something obvious?
4 replies
FFilament
Created by David | Fortune Validator on 1/31/2024 in #❓┊help
Model component taking up white space
Hi all I have a filmanet blade component inside a custom page. The component exists inside a flex container with a button to trigger the model ( code below ). The filament modal compoenent howver is taking up space whilst inactive. Any ideas on stopping it taking up space?
<i class="p-2 bi bi-file-earmark-text-fill"
x-on:click="$dispatch('open-modal', { id: 'docket_price_model_order_{{ $row->id }}' })"></i>
<x-filament::modal id="docket_price_model_order_{{ $row->id }}" width="5xl"> ....
<i class="p-2 bi bi-file-earmark-text-fill"
x-on:click="$dispatch('open-modal', { id: 'docket_price_model_order_{{ $row->id }}' })"></i>
<x-filament::modal id="docket_price_model_order_{{ $row->id }}" width="5xl"> ....
3 replies
FFilament
Created by David | Fortune Validator on 1/21/2024 in #❓┊help
Images 404
hi all I hope someone can help. I am getting 404 on the Files I've uploaded (images). Disk is config is set to 'local'. I tried public and it worked but then anyone could view the images which I dont want. Only the logged in to the panel. I can see them uploaded to:
/storage/app/symptoms but I cannot view in my Tables\Columns\ImageColumn::make('photos')->circular()->stacked(),
/storage/app/symptoms but I cannot view in my Tables\Columns\ImageColumn::make('photos')->circular()->stacked(),
Disk: Local
FileUpload::make('photos')->directory('symptoms')->multiple()->image()->imageEditor()->moveFiles()->columnSpan(2),
FileUpload::make('photos')->directory('symptoms')->multiple()->image()->imageEditor()->moveFiles()->columnSpan(2),
Any help would be greatly appreciated Further context, this is just a personal project for my family so I don’t need to use s3 storage. But equally as this is on a site ( behind login ) i don’t want to use fully public storage.
38 replies
FFilament
Created by David | Fortune Validator on 1/20/2024 in #❓┊help
Today Page
Hi all I’m a little stumped on the best route here. To simplify things I have a journal type app. I want a TODAY link on the nav which loads from the Day model the today’s record. Questions 1) can I run some custom pho on page load to create the date record in day model? 2) can I then have custom query on page load to always be the latest entry ( I.e the newly created record ). I welcome a better method!! Not sure if this is a custom page setup or if I can use the already coded View page for my DayResource. Also note this page has two relation managers. I currently have a Day list view with a create today log but is quite like a Today link which people can bookmark and when it loads it’ll create said day if it doesn’t already exist. Any advice would be appreciated. Thank you.
5 replies
FFilament
Created by David | Fortune Validator on 1/19/2024 in #❓┊help
Get data in ->after() on a custom action
I have the following code. I would like to get the newly created record to use as a redirect in the ->after() function. If any one could help I would appreciate it. Also if I am doing this a long way please let me know.
Action::make('Log Today')
->button()
->action(function (Action $action){
$tenantId = Filament::getTenant()->id;
$today = date('Y-m-d');
$day = Day::firstOrCreate(
['date' => $today, 'person_id' => $tenantId],
['date' => now()]
);
})
->after(function () {
Notification::make()
->success()
->title('Day Record Created!')
->send();

return redirect()->route('filament.app.resources.days.view',[
'tenant' => Filament::getTenant(),
'record' => Day::where('date',date('Y-m-d'))->where('person_id',Filament::getTenant()->id)->first(),
]);
})
Action::make('Log Today')
->button()
->action(function (Action $action){
$tenantId = Filament::getTenant()->id;
$today = date('Y-m-d');
$day = Day::firstOrCreate(
['date' => $today, 'person_id' => $tenantId],
['date' => now()]
);
})
->after(function () {
Notification::make()
->success()
->title('Day Record Created!')
->send();

return redirect()->route('filament.app.resources.days.view',[
'tenant' => Filament::getTenant(),
'record' => Day::where('date',date('Y-m-d'))->where('person_id',Filament::getTenant()->id)->first(),
]);
})
21 replies
FFilament
Created by David | Fortune Validator on 1/15/2024 in #❓┊help
Badge Color From Relationship
I have the following:
Tables\Columns\TextColumn::make('symptomLogs.symptom.name')
->badge()
->color(fn (string $state): string => Symptom::where('name',$state)->first()->color)
->sortable(),
Tables\Columns\TextColumn::make('symptomLogs.symptom.name')
->badge()
->color(fn (string $state): string => Symptom::where('name',$state)->first()->color)
->sortable(),
Context: I want the badge color to be the color set in the Symptom table. I am outputting a list of days which will show symptoms logged via the SymptomLogs table etc. Showing the name in the badge works just fine and I can use the Eloquent Query to get the color but I feel like there may be better way to accomplish this? .
2 replies
FFilament
Created by David | Fortune Validator on 1/15/2024 in #❓┊help
[3.2.0] Export - Download
Great update, hats off to the team. Slight bug ( hopefully not my end ), when I click the link in the database notification to download the .CSV file it takes me to the link /filament/exports/8/download?format=csv which just outputs the contents on the page itself, I have to then refresh the page to get it to physically download the file. Any wisdom would be appreciated.
5 replies
FFilament
Created by David | Fortune Validator on 1/14/2024 in #❓┊help
Multi Tenancy the right path ?
Hi all I want to build a quick app to monitor my two children’s food intake and allergies. One login for myself and wife so we can view the data. Obviously I would like both children’s data to be separate. I would be able to log food for the data and any symptoms they may have. Ideally with a dashboard to show the data. Would multi tenant setup be the right way to go ? With each ‘team’ as a child ? Or have I over complicated things ?
8 replies
FFilament
Created by David | Fortune Validator on 1/8/2024 in #❓┊help
Custom Column In Table
I have two models. Estimates & Dockets. Relationships are setup in that an Estimate HasOne Docket. Both estimate and docket tables have a title field. I am working on a custom search/table. I want the docket title to show up instead of the estimate title on the TITLE column only if a docket exists. eg
$docket->exists()) ? $docket->title : $estimate->title
$docket->exists()) ? $docket->title : $estimate->title
But I cannot work out how to get that into a singular column. Any help would be appreciated. Thank you
6 replies
FFilament
Created by David | Fortune Validator on 1/6/2024 in #❓┊help
Custom theme issue
Scratching my head here. I've created a custom theme on another project without issue. I have added Filament panels under /admin path and all works fine. I have run the commands for a custom theme and added the neccessary lines: Vite Config:
import { defineConfig } from 'vite';
import laravel, { refreshPaths } from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.scss',
'resources/js/app.js',
'resources/css/filament/admin/theme.css',
],
refresh: [
...refreshPaths,
'app/Livewire/**',
],
}),
],
});
import { defineConfig } from 'vite';
import laravel, { refreshPaths } from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.scss',
'resources/js/app.js',
'resources/css/filament/admin/theme.css',
],
refresh: [
...refreshPaths,
'app/Livewire/**',
],
}),
],
});
I can see the css file on the source, however its not compiling the tailwind and shows me this.
@tailwind base;@tailwind components;@tailwind utilities;@layer base{:root.dark{color-scheme:dark}[data-field-wrapper]{scroll-margin-top:8rem}}@config "tailwind.config.js";
@tailwind base;@tailwind components;@tailwind utilities;@layer base{:root.dark{color-scheme:dark}[data-field-wrapper]{scroll-margin-top:8rem}}@config "tailwind.config.js";
For some reason its not building the tailwind assets. Custom plain CSS in this file will work. But the page styles are broken without the taildwind.!!! I'm at a loss on how to get this file to actually compile. any help would be greatly appreciated.
4 replies
FFilament
Created by David | Fortune Validator on 1/4/2024 in #❓┊help
Slow TextColumn with relationship exists
I am using the below code on my Client table:
Tables\Columns\IconColumn::make('estimates_exists')->exists('estimates')->boolean(),
Tables\Columns\IconColumn::make('estimates_exists')->exists('estimates')->boolean(),
This is the relationship:
public function estimates()
{
return $this->hasMany(Estimate::class);
}
public function estimates()
{
return $this->hasMany(Estimate::class);
}
It could have thousands of estimates. I simple need a boolean tick on my Table List to show if a client has an estimate against their name. The issue is its very very slow to load the page. If I comment out this line then its fast again. I dont suppose any knows of a better way to speed this up?
4 replies