Jamie Cee
Jamie Cee
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
FFilament
Created by Jamie Cee on 1/3/2024 in #❓┊help
Updating state after filtering
Cant find out if it's currently possible, where after filtering, I update the state and tooltip of values.
Filter::make('languages')
->form([
Select::make('locale')
->options(Locales::all()->pluck('title', 'locale'))
->selectablePlaceholder(false),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['locale'],
function (Builder $query, $state) {
if ($state == null || $state == "en") {
return $query;
}
return $query->whereHas('locales', fn (Builder $query) => $query->where('locales_offer.locale', $state));
}
);
}),
Filter::make('languages')
->form([
Select::make('locale')
->options(Locales::all()->pluck('title', 'locale'))
->selectablePlaceholder(false),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['locale'],
function (Builder $query, $state) {
if ($state == null || $state == "en") {
return $query;
}
return $query->whereHas('locales', fn (Builder $query) => $query->where('locales_offer.locale', $state));
}
);
}),
When I filter a different language, I want to update the fields with the translations, and add a tooltip with the originals
8 replies
FFilament
Created by Jamie Cee on 1/2/2024 in #❓┊help
select input for actions
I am not sure if this is in the documentation as I cant find any reference... I have my list table, and they each have the view, edit and delete action. However, I then want to create a 4th action that is a dropdown populated with language locales. I want the option to open the dropdown and select a language locale then I can do the custom action to open the edit screen but with the content of that locale
5 replies
FFilament
Created by Jamie Cee on 12/13/2023 in #❓┊help
requiredWithout validation
I am trying to run a requiredWithout validation rule, I want contact number to be required if email is null. The issue I am having is that contact number is inside the schema of a fieldset that is from the profile model. Where as email is on user directly.
Forms\Components\TextInput::make('contact_number')
->unique(app(Profile::class)->getTable(), 'contact_number', $form->getRecord()->profile ?? null)
->requiredWithout(function ($form) {
// return $form->getRecord()->email;
return $form->getComponent('email')->getValue();
})
->tel()
->maxLength(255),
Forms\Components\TextInput::make('contact_number')
->unique(app(Profile::class)->getTable(), 'contact_number', $form->getRecord()->profile ?? null)
->requiredWithout(function ($form) {
// return $form->getRecord()->email;
return $form->getComponent('email')->getValue();
})
->tel()
->maxLength(255),
This is my current attempt. But getting this error: An attempt was made to evaluate a closure for [Filament\Forms\Components\TextInput], but [$form] was unresolvable. If I just have the requiredWithout('email') the validation is looking for data.profile.email which is incorrect as email isn't in profile, and if I call user.email its then searching data.profile.user.email
7 replies
FFilament
Created by Jamie Cee on 12/12/2023 in #❓┊help
File Upload Error
No description
7 replies