leoblanski
leoblanski
FFilament
Created by leoblanski on 5/30/2024 in #❓┊help
ColorPicker Required Bug
No description
31 replies
FFilament
Created by leoblanski on 5/7/2024 in #❓┊help
File Importer - S3 Error
Hello Everyone. I'm trying to use the Import Action inside a Relation Manager -> Header Action. I've defined in my ENV the FILAMENT_FILESYSTEM_DISK as S3 because I use FileUpload in other parts of the system and I need to upload it inside S3, and it works. When I try to import some file, it returns an error:
Error executing "GetObject" on "https://regalwings-public.s3.amazonaws.com//var/www/storage/app/livewire-tmp/vn1vKefW0zzLkUDq1QO5d12UgpC94D-metaZGF5cy5jc3Y%3D-.csv";
Error executing "GetObject" on "https://regalwings-public.s3.amazonaws.com//var/www/storage/app/livewire-tmp/vn1vKefW0zzLkUDq1QO5d12UgpC94D-metaZGF5cy5jc3Y%3D-.csv";
Upon observation, it's mounting a weird path. If I remove FILAMENT_FILESYSTEM_DISK from the env, it works like a charm. However, in that case, I need to specify ->disk(s3) in all my FileUploads, and it doesn't make sense. I would like to keep my TemporaryUploadedFile to Import in my local use S3 just for Pictures, etc.
2 replies
FFilament
Created by leoblanski on 3/27/2024 in #❓┊help
Any idea to render using PanelsRenderHook with TOPBAR_START After Open Menu Icon ?
No description
2 replies
FFilament
Created by leoblanski on 3/25/2024 in #❓┊help
How to update Filament View dispatching from a Livewire Component?
I've created a new component and used it inside a Filament View. I've set up a listener on the ClientView as shown below: protected $listeners = [ 'refreshViewClient' => '$refresh' ]; And I'm calling $this->dispatch('refreshViewClient'); But for some reason, this specific component is not updating along with the entire screen. For example, within the Header, I have a custom component where I call it as mentioned above, and it works perfectly. However, inside this particular component, it's not working. This issue occurs whether I try to update the component -> view or view -> component; neither works.
9 replies
FFilament
Created by leoblanski on 3/12/2024 in #❓┊help
Select Field Required Wrong Validation
No description
7 replies
FFilament
Created by leoblanski on 3/11/2024 in #❓┊help
Select Blade Component - Searchable
Is that possible using Filament Select component with "searchable" option directly into blade ? I'm trying to create an Action with specific View modalContent trying to use Filament components but i'm not able to use "form" from action from example, because When I use $this->form, it doesn't appear where I'm inserting it; instead, it shows up at the end of my view. Therefore, I'm trying to create everything in the Blade file, but I'm facing issues with using the searchable select. That's why I would like this possibility, as it would allow me to continue directly in the Blade file
6 replies
FFilament
Created by leoblanski on 2/22/2024 in #❓┊help
Fill Not Working - MultiSelect - With Pivot Table Relationship
I'm trying to create an Action to select some Travelers to attach to an Trip. I have a table called 'trip_travelers' that has 'trip_id' and 'traveler_id'. Trip Model:
public function travelers(): BelongsToMany
{
return $this->belongsToMany(Traveler::class, 'trip_travelers');
}
public function travelers(): BelongsToMany
{
return $this->belongsToMany(Traveler::class, 'trip_travelers');
}
The same with Travelers. I made a relationManager with createAction as default and it works like a Charm, creating records and already attaching with Model. But I need to create an Action to Attach existing Travelers so I decided to use a MultiSelect with custom Action to open a modal and select the Travelers. The problem is that fillForm is not filling my form with selected options. My Action:
Action::make('Manage Traveler')
->record($this->ownerRecord)
->model(Traveler::class)
->fillForm(function ($record) {
return $this->ownerRecord->travelers()->get()->toArray();
})
->form(function () {
return [
MultiSelect::make('travelers')
->model(Trip::class)
->relationship('travelers', 'first_name')
->preload()
->options(
function () {
return Traveler::query()->where('client_id', $this->ownerRecord->client_id)->pluck('first_name', 'id');
}
)
->createOptionForm(function () {
return Traveler::getForm();
})
->required()
];
})
Action::make('Manage Traveler')
->record($this->ownerRecord)
->model(Traveler::class)
->fillForm(function ($record) {
return $this->ownerRecord->travelers()->get()->toArray();
})
->form(function () {
return [
MultiSelect::make('travelers')
->model(Trip::class)
->relationship('travelers', 'first_name')
->preload()
->options(
function () {
return Traveler::query()->where('client_id', $this->ownerRecord->client_id)->pluck('first_name', 'id');
}
)
->createOptionForm(function () {
return Traveler::getForm();
})
->required()
];
})
My relationManager is attached to TripResource.
4 replies
FFilament
Created by leoblanski on 1/31/2024 in #❓┊help
Override Global Search View - Custom View
I'm trying to modify the Global Search from Filament using my custom view but I'm not achieving to do this. I would like to use some funcs from Algolia like recent searchs among others, to be able to do this, I create a new livewire component and I would like to render on Global Search Filament place. I found a way using
FilamentView::registerRenderHook
FilamentView::registerRenderHook
but I dont know how to render the Livewire Component. Any idea ? Livewire Component:
<?php

namespace App\Livewire;

use App\Models\Client;
use Livewire\Component;

class GlobalSearch extends Component
{
public $search= '';
public $results= [];

public function render()
{
$this->results = Client::search($this->search)->get();
return view('livewire.global-search');
}
}
<?php

namespace App\Livewire;

use App\Models\Client;
use Livewire\Component;

class GlobalSearch extends Component
{
public $search= '';
public $results= [];

public function render()
{
$this->results = Client::search($this->search)->get();
return view('livewire.global-search');
}
}
4 replies
FFilament
Created by leoblanski on 1/30/2024 in #❓┊help
Field getting focus wrongly with "CopyToClipboard" Action
Hi Guys! I have created a JavaScript function to be used within some components, allowing users to copy values to the Clipboard. This is done in a legacy way, by creating a textarea, inserting the value, and then executing the copy action. When I open the modal action and select an item to copy without interacting with input forms, it works like a charm. Also, when using "body" with the
mohamedsabil83/filament-forms-tinyeditor
mohamedsabil83/filament-forms-tinyeditor
plugin, it works seamlessly. However, when I click on another input field and then try to copy, the copied value is from the last focused field. Example: Works: Open Action -> Merge Fields -> Click on list -> Copy perfectly; Works: Open Action -> Add some info to Body -> Merge Fields -> Click on list -> Copy perfectly; Doesn't work: Open Action -> Click on subject -> Click on merge fields -> Even if I click on the body, the focus continues to be on the last input I clicked on. Do you guys have any ideas? I've tried forcing
->autofocus(false)
->autofocus(false)
but it still doesn't work. Initially, I attempted to focus on the created textarea in my script, but it still isn't functioning as expected.
4 replies
FFilament
Created by leoblanski on 1/29/2024 in #❓┊help
Copy to Clipboard Inside Custom Livewire Form
Hey guys, I'm trying to do something really simple but for some reason it is not working. I have a list of variables that I need to show in some views, and this list is copyable, so when user click in a LI, copy to clipboard and show a notification. It works as a charm when I'm using this script inside an view, and doesn't works in other. One is just a list with LI and other is a dropdown, that when click on item, must copy. Both are executing "Notification" from filament, but one copy, other none.
7 replies
FFilament
Created by leoblanski on 1/24/2024 in #❓┊help
fileUpload inside Action Modal
I'm creating an action where User is able to send emails. On email form action I create a new action where I want to open a modal where user can manage Attachments, currently I'm using FileUpload, but I'm not achieving to get the file after upload and not make it so that when it returns to this modal it already presents the selected files. Do you have any idea in hot to do this without creating a custom component view ?
6 replies
FFilament
Created by leoblanski on 1/18/2024 in #❓┊help
Snapshot missing on Livewire component - Header Action
Hey guys. I made a view resource in my application where I have a view blade loaded into Section Component.
Section::make()->view('filament.user.resources.client-resource.widgets.client.header-session'...
Section::make()->view('filament.user.resources.client-resource.widgets.client.header-session'...
Inside view, I'm using a custom livewire component to show tags:
@if ($client->tags->count() > 0)
<div class="flex gap-3">
@foreach ($client->tags as $tag)
<livewire:badge-tag-action :tag="$tag" :model="$client"/>
@endforeach
</div>
@endif
@if ($client->tags->count() > 0)
<div class="flex gap-3">
@foreach ($client->tags as $tag)
<livewire:badge-tag-action :tag="$tag" :model="$client"/>
@endforeach
</div>
@endif
Everything is working well at this point, but for some reason, When I execute my Header Action, returns livewire error, IF i remove this custom view, It works fine, what i'm doing wrong? Action code:
5 replies
FFilament
Created by leoblanski on 1/16/2024 in #❓┊help
Creating custom livewire action Componente using relationships
Hey guys. I'm trying to create a Livewire component that will return an Action where I'm using
->fillForm(function ()
->fillForm(function ()
to fill a multi-select with tag options. It works perfectly when I'm using this action directly on my resource, using headerFunction from View page, but using a custom livewire component doesn't work. Taking a look I imagine that is something related with relationships. Blade: <livewire:manage-tag-action :model="$client"/> Component:
class ManageTagAction extends Component implements HasForms, HasActions
{
use InteractsWithForms;
use InteractsWithActions;

public Tag $tag;
public Model $model;

public function mount(Tag $tag, Model $model)
{
$this->tag = $tag;
$this->model = $model;
}
class ManageTagAction extends Component implements HasForms, HasActions
{
use InteractsWithForms;
use InteractsWithActions;

public Tag $tag;
public Model $model;

public function mount(Tag $tag, Model $model)
{
$this->tag = $tag;
$this->model = $model;
}
12 replies
FFilament
Created by leoblanski on 1/10/2024 in #❓┊help
RichEditor doesn't upload Image on Simple Resource (Modal)
Could anyone help me with this point pls ? Basically what I'm doing is creating a new RichEditor component into form, it works perfectly when I'm using complete resources (With CRUD pages), but for some reason, I don't know if it's a bug or I'm doing something wrong, when using in a simple resource, generatated simply with "php artisan filament:resource TestResource --simple" it doesn't work... Same code in each resource:
public static function form(Form $form): Form
{
return $form
->schema([
RichEditor::make('body')
->label('Description')
->required(),
]);
}
public static function form(Form $form): Form
{
return $form
->schema([
RichEditor::make('body')
->label('Description')
->required(),
]);
}
Returns: Uncaught Could not find Livewire component in DOM tree on console
4 replies
FFilament
Created by leoblanski on 1/2/2024 in #❓┊help
Custom Domains - Share Data between - Share Session
In my application, the user has a team, and this team can have a custom domain. I created a middleware that validates if the user has a custom domain. If they do and are accessing the application with a default domain, I would like to redirect them to the custom domain. However, when I do this, I lose the session, and the user is taken back to the login screen. If I hadn't lost the session, the problem would have been resolved, but as I wasn't able to do this, I chose to continue and display a message on the login screen, advising that the user has a custom domain and therefore must log in again, but when redirect also I can no longer display the message on the login page, I even tried to overwrite the login View and pass some information via URL but it is not possible. The closest i got:
16 replies
FFilament
Created by leoblanski on 12/22/2023 in #❓┊help
Edit page as Index resource page
I have a resource that I want users to only edit. It doesn't make sense to show an index page with a list of resources. Therefore, I would like the "Tenant" menu, for example, to directly open the edit page with the form to make changes. I could not set the Pages with the ID because I have no information about session at this point. Normal resource:
public static function getPages(): array
{
return [
'index' => Pages\ListTeams::route('/'),
'create' => Pages\CreateTeam::route('/create'),
'edit' => Pages\EditTeam::route('/{record}/edit'),
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListTeams::route('/'),
'create' => Pages\CreateTeam::route('/create'),
'edit' => Pages\EditTeam::route('/{record}/edit'),
];
}
I want to do something like:
public static function getPages(): array
{
return [
'index' => Pages\EditTeam::route('/{record}/edit'),
];
}
public static function getPages(): array
{
return [
'index' => Pages\EditTeam::route('/{record}/edit'),
];
}
I've attempted to use custom pages that extend from Page and fill on mount function, but it returns errors. Missing required parameter for [Route: filament.user.resources.teams.index] [URI: teams/{record}/edit] [Missing parameter: record]. It's because when Panel is mounted, doesn't have information about which ID Tenant will edit.
3 replies
FFilament
Created by leoblanski on 12/11/2023 in #❓┊help
Redirect to login page showing error
I'm trying to create a Middleware to validate User Status (When user is logged in and admins change the status to inactive, I have to redirect user to the login page and show a specific error). I can show specific errors on login, but just overriding function throwFailureValidationException from Login and when user is already on login page, but when i am inside system and try to redirect with something like bellow, it not works. (Redirect but doesn't show message error).

throw ValidationException::withMessages([
'data.login' => __('filament-panels::pages/auth/login.messages.failed'),
]);

throw ValidationException::withMessages([
'data.login' => __('filament-panels::pages/auth/login.messages.failed'),
]);
8 replies