Jamie Cee
Jamie Cee
FFilament
Created by Jamie Cee on 7/10/2024 in #❓┊help
Pagination with options
I have a view
<div>
{{ $this->productInfolist }}

<x-filament::pagination :paginator="$this->data['budgetPagination']" style="margin-top: 15px;"
:page-options="[1, 5, 10, 20, 50, 'all']" :current-page-option-property="$this->perPage" />
{{-- /> --}}
</div>
<div>
{{ $this->productInfolist }}

<x-filament::pagination :paginator="$this->data['budgetPagination']" style="margin-top: 15px;"
:page-options="[1, 5, 10, 20, 50, 'all']" :current-page-option-property="$this->perPage" />
{{-- /> --}}
</div>
And in my Page class, I define
public int | string $perPage = 5;
protected static string $view = 'filament.pages.report';
public int | string $perPage = 5;
protected static string $view = 'filament.pages.report';
Then I have my productInfolist function return an InfoList. So now pagination works to perPage, but when I change the options, nothing happens. Any ideas?
1 replies
FFilament
Created by Jamie Cee on 7/10/2024 in #❓┊help
Reactive filter updating
So on my custom page, where I have a filtersForm. Its generated with:
public function filtersForm(Form $form): Form
{
return $form->schema([
Forms\Components\Section::make('Filters')
->schema([
Forms\Components\Grid::make(4)
->schema([
Forms\Components\Select::make('client')
->label('Client')
->placeholder('Select a client')
->options($this->getClientOptions())
->default(''),

Forms\Components\Select::make('project')
->label('Project')
->placeholder('Search for a project')
->options($this->getProjectOptions())
->default(''),
])
])
->collapsed()
->persistCollapsed(),
]);
}

/**
* Client filter dropdown
*
* @return array
*/
protected function getClientOptions(): array
{
$client = \App\Models\Client::query();

if (empty($this->filters['client'])) {
$this->filters['project'] = null;
}

return $client->pluck('name', 'id')->toArray();
}

protected function getProjectOptions()
{
$project = \App\Models\Project::query();

if (!empty($this->filters['client'])) {
$project->where('client_id', $this->filters['client']);
}

return $project->pluck('name', 'id')->toArray();
}
public function filtersForm(Form $form): Form
{
return $form->schema([
Forms\Components\Section::make('Filters')
->schema([
Forms\Components\Grid::make(4)
->schema([
Forms\Components\Select::make('client')
->label('Client')
->placeholder('Select a client')
->options($this->getClientOptions())
->default(''),

Forms\Components\Select::make('project')
->label('Project')
->placeholder('Search for a project')
->options($this->getProjectOptions())
->default(''),
])
])
->collapsed()
->persistCollapsed(),
]);
}

/**
* Client filter dropdown
*
* @return array
*/
protected function getClientOptions(): array
{
$client = \App\Models\Client::query();

if (empty($this->filters['client'])) {
$this->filters['project'] = null;
}

return $client->pluck('name', 'id')->toArray();
}

protected function getProjectOptions()
{
$project = \App\Models\Project::query();

if (!empty($this->filters['client'])) {
$project->where('client_id', $this->filters['client']);
}

return $project->pluck('name', 'id')->toArray();
}
I want project to update live with my data when client changes. So for example, I select client 1, and select project 1 (as that belongs to client 1). If I then change to Client 2, I need Project 1 to reset when it changes, so I can also populate the infolist live, being returned.
5 replies
FFilament
Created by Jamie Cee on 7/9/2024 in #❓┊help
Page Filters with InfoLists not working
I have a lot going on here and not too sure whats causing what. So currently happening: I can change a filter and the response will update, but if I remove the filter back to "select a x". The data goes blank, I want this to reset that filter and display all data as normal (well, minus that filter I just removed). Is it possible to get the table style filters instead, that may be easier?
9 replies
FFilament
Created by Jamie Cee on 7/8/2024 in #❓┊help
Paginated InfoLists
Is it possible to paginate info lists? I have a custom page with an infolist just to collect a collection of data from multiple relations into something readable, but there may be many records, so want to implement pagination into it.
4 replies
FFilament
Created by Jamie Cee on 6/17/2024 in #❓┊help
Live notifications
Im a little confused how notifications are working. So I've setup and installed pusher and echo etc. This is my notification
$message = $e->getMessage();
Notification::make()
->title('Translation failed')
->body($message)
->broadcast($this->initiator);
$message = $e->getMessage();
Notification::make()
->title('Translation failed')
->body($message)
->broadcast($this->initiator);
I have a queue:listen going, I can see the BroadcastNotificationCreated event, I can see in my pusher dashboard, the channel message come through and tells me the format is filament etc. But no notification comes through while im on my admin panel. What am I missing?
5 replies
FFilament
Created by Jamie Cee on 6/17/2024 in #❓┊help
Issue uploading file
No description
2 replies
FFilament
Created by Jamie Cee on 5/21/2024 in #❓┊help
Custom View Form Validation
I have a route that triggers a view that looks like this:
@php
$livewire = new \App\Http\Livewire\ResetPassword();
@endphp
<div class="fi-simple-layout flex min-h-screen flex-col items-center">
<div class="fi-simple-main-ctn flex w-full flex-grow items-center justify-center">

<main
class="fi-simple-main my-16 w-full bg-white px-6 py-12 shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10 sm:rounded-xl sm:px-12 sm:max-w-lg">

<x-filament-panels::layout.base :livewire="$livewire">

<x-filament-panels::header.simple :heading="$heading ??= $livewire->getHeading()"
:subheading="$subheading ??= $livewire->getSubHeading()" />


{{-- Content --}}
<x-filament-panels::form action="{{ route('password.reset.process') }}" method="POST"
style="margin-top: 5%;">
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<input type="hidden" name="token" value="{{ request()->token }}" />
<input type="hidden" name="email" value="{{ request()->query('email') }}" />



<x-filament-forms::field-wrapper.label prefix="Password" />
<x-filament::input.wrapper>
<x-filament::input type="password" name="password" placeholder="Enter Password" id="password" />
</x-filament::input.wrapper>

<x-filament-forms::field-wrapper.label prefix="Confirm Password" />
<x-filament::input.wrapper>
<x-filament::input type="password" name="password_confirmation" placeholder="Confirm Password"
id="password_confirmation" />
</x-filament::input.wrapper>


<x-filament::button type="submit" color="primary">
Reset Password
</x-filament::button>

</x-filament-panels::form>

</x-filament-panels::layout.base>
</main>
</div>
</div>
@php
$livewire = new \App\Http\Livewire\ResetPassword();
@endphp
<div class="fi-simple-layout flex min-h-screen flex-col items-center">
<div class="fi-simple-main-ctn flex w-full flex-grow items-center justify-center">

<main
class="fi-simple-main my-16 w-full bg-white px-6 py-12 shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10 sm:rounded-xl sm:px-12 sm:max-w-lg">

<x-filament-panels::layout.base :livewire="$livewire">

<x-filament-panels::header.simple :heading="$heading ??= $livewire->getHeading()"
:subheading="$subheading ??= $livewire->getSubHeading()" />


{{-- Content --}}
<x-filament-panels::form action="{{ route('password.reset.process') }}" method="POST"
style="margin-top: 5%;">
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<input type="hidden" name="token" value="{{ request()->token }}" />
<input type="hidden" name="email" value="{{ request()->query('email') }}" />



<x-filament-forms::field-wrapper.label prefix="Password" />
<x-filament::input.wrapper>
<x-filament::input type="password" name="password" placeholder="Enter Password" id="password" />
</x-filament::input.wrapper>

<x-filament-forms::field-wrapper.label prefix="Confirm Password" />
<x-filament::input.wrapper>
<x-filament::input type="password" name="password_confirmation" placeholder="Confirm Password"
id="password_confirmation" />
</x-filament::input.wrapper>


<x-filament::button type="submit" color="primary">
Reset Password
</x-filament::button>

</x-filament-panels::form>

</x-filament-panels::layout.base>
</main>
</div>
</div>
76 replies
FFilament
Created by Jamie Cee on 5/2/2024 in #❓┊help
Get operation in custom component resource
I have a custom form component, but im wanting to access the current operation inside to have some conditional logic. I know I can obtain other data such as $isDisabled() and $getHelperText() - but I cant seem to find any for getting operation?
2 replies
FFilament
Created by Jamie Cee on 4/30/2024 in #❓┊help
Get Active Colour
So I have a custom blade view, and it makes use of the color attribute:
<x-filament::button type="submit" color="primary">
Submit
</x-filament::button>
<x-filament::button type="submit" color="primary">
Submit
</x-filament::button>
However, if I change that colour in the service provider, is there a way I can obtain the active colour?
3 replies
FFilament
Created by Jamie Cee on 4/4/2024 in #❓┊help
Method App\Http\Livewire\Twofa::getRenderHookScopes does not exist.
So I had a 2fa system setup and working, and wondering if a recent composer update has pulled some changes that is now causing this error. I cant find any reference to me calling getRenderHookScopes so not sure where its going wrong
7 replies
FFilament
Created by Jamie Cee on 3/26/2024 in #❓┊help
Tab Forms
I have a foreach loop to define tabs and include the form depending on the tab. Since it's based on locales, I want the states of the form inputs to change depending on the locale. My issue is that each tab is still having the same state, not changing per tab. Not sure what im missing.
21 replies
FFilament
Created by Jamie Cee on 3/26/2024 in #❓┊help
State not updating
Forms\Components\TextInput::make('title')
->label("Title ($locale->locale)")
->required()
->maxLength(100)
->afterStateHydrated(function (Forms\Components\TextInput $component, $record) use ($locale) {
return $component->state($record->locales()->where('locales_offer.locale', $locale->locale)->first()->pivot->title ?? $record->title);
})
->live()
->key('title'),
Forms\Components\TextInput::make('title')
->label("Title ($locale->locale)")
->required()
->maxLength(100)
->afterStateHydrated(function (Forms\Components\TextInput $component, $record) use ($locale) {
return $component->state($record->locales()->where('locales_offer.locale', $locale->locale)->first()->pivot->title ?? $record->title);
})
->live()
->key('title'),
So I have this grid thats inside a tab component. When I switch component, it should update the input value. But the content is not currently changing. If I dd($component->state); the field doesn't exist, but dd component does show the TextInput element
2 replies
FFilament
Created by Jamie Cee on 3/25/2024 in #❓┊help
Export download prompt
https://filamentphp.com/docs/3.x/actions/prebuilt-actions/export Unless im blind, is there a way to click export, then prompt the ability for the user to download and save to their device, rather than saving in storage? As im assuming this is gonna require a separate link or button to doiwnload the exported file?...
27 replies
FFilament
Created by Jamie Cee on 3/14/2024 in #❓┊help
Missing field on relationship
I have this relationship fieldset
Fieldset::make('Address')
->relationship('address')
->schema([
Forms\Components\TextInput::make('city')
->required(),
Forms\Components\TextInput::make('state')
->required(),
Forms\Components\TextInput::make('zip')
->required(),
Forms\Components\TextInput::make('origin_country')
->disabled()
->dehydrated(false)
->readOnly(),
])
->mutateRelationshipDataBeforeFillUsing(fn ($data) => dd($data)),
Fieldset::make('Address')
->relationship('address')
->schema([
Forms\Components\TextInput::make('city')
->required(),
Forms\Components\TextInput::make('state')
->required(),
Forms\Components\TextInput::make('zip')
->required(),
Forms\Components\TextInput::make('origin_country')
->disabled()
->dehydrated(false)
->readOnly(),
])
->mutateRelationshipDataBeforeFillUsing(fn ($data) => dd($data)),
My issue is, in the $data, origin_country does not exist. But in the database it exists, in my model fillable it exists. Am I missing something?
11 replies
FFilament
Created by Jamie Cee on 3/12/2024 in #❓┊help
Select Option for userMenuItems
Is there a way to define a select option dropdown in the MenuItem of the userMenuItems, either clicking and opening a modal with a dropdown, or a dropdown directly? Even a bit of guidance on what I'd need to build something custom for this? It will only be changing a session state, so nothing complex
5 replies
FFilament
Created by Jamie Cee on 2/21/2024 in #❓┊help
Implements on User model
Question, not sure if it's been raised before. I have a custom in-house authentication package, which means I have a User that extends authenticatable in the package. Then in my project level, my User model extends the package model, and I define the bind inside the AppServiceProvider. The issue I have is the implements for: FilamentUser, HasName. If I add these to the project level, it struggles to find the functions in the project model, and only seems to work on the User model that is extending authenticatable... is there a work around for this?
2 replies
FFilament
Created by Jamie Cee on 2/20/2024 in #❓┊help
http instead of https production issue
Currently have my .env set to "production" instead of "local" for my APP_ENV. However, in my admin panel, none of the js is working for the table due to this:
Mixed Content: The page at 'https://mydomain.com/admin/guests' was loaded over HTTPS, but requested an insecure script 'http://mydomain.com/js/filament/tables/components/table.js?v=3.2.23.0'. This request has been blocked; the content must be served over HTTPS.
Mixed Content: The page at 'https://mydomain.com/admin/guests' was loaded over HTTPS, but requested an insecure script 'http://mydomain.com/js/filament/tables/components/table.js?v=3.2.23.0'. This request has been blocked; the content must be served over HTTPS.
Really confused whats going on
7 replies
FFilament
Created by Jamie Cee on 1/29/2024 in #❓┊help
Route Middleware resource
Just want to know if theres an easier way to do this before I create a separate page for account information. I have a middleware on my user resource:
protected static string | array $routeMiddleware = [
GlobalTwoFactorAuth::class,
];
protected static string | array $routeMiddleware = [
GlobalTwoFactorAuth::class,
];
However, I want a user to be able to edit their own account regardless of this middleware.
7 replies
FFilament
Created by Jamie Cee on 1/29/2024 in #❓┊help
Duplicated Widget
No description
10 replies
FFilament
Created by Jamie Cee on 1/5/2024 in #❓┊help
Update table column state live
I have my table in a resource, and I want to change the state of that column in my listing when a filter is on. So it has default values, but if filter is set to A, I want field to change state/value
4 replies