mohdaftab
mohdaftab
FFilament
Created by mohdaftab on 10/20/2024 in #❓┊help
Sushi to dynamically load data from API using search keyword
Hello, I am using Sushi to load a data into a table with API data using a search keyword. But I am missing something here as I am not able to load the data from API after the search but if I provide the search term initially then it loads the proper data to the table. Please check my code and help me fix this, thank you so much. This is my custom page code, removed the imports due to limitations.
<?php

namespace App\Filament\Dashboard\Pages;

class TargetFinderGenerator extends Page implements HasForms, HasTable
{

use InteractsWithTable, InteractsWithForms;

public $keyword;
public $selected = [];

protected static ?string $navigationIcon = 'heroicon-o-arrow-right-end-on-rectangle';

protected static ?string $navigationGroup = 'Target Finder';

protected static string $view = 'filament.dashboard.pages.target-finder-generator';


public ?array $data = [];



public function form(Form $form): Form
{
return $form
->statePath('data')
->schema([
Grid::make(2)
->schema([
TextInput::make("keyword")
->default(2)
->required(),
])

]);
}

public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make("name"),
TextColumn::make("email"),
TextColumn::make("body"),
])
->filters([])
->actions([])
->bulkActions([])
->query(TargetFinder::query());
}


public function fetchApiData()
{
$this->selected = [];
(new TargetFinder)->getRows($this->data);
}
}
<?php

namespace App\Filament\Dashboard\Pages;

class TargetFinderGenerator extends Page implements HasForms, HasTable
{

use InteractsWithTable, InteractsWithForms;

public $keyword;
public $selected = [];

protected static ?string $navigationIcon = 'heroicon-o-arrow-right-end-on-rectangle';

protected static ?string $navigationGroup = 'Target Finder';

protected static string $view = 'filament.dashboard.pages.target-finder-generator';


public ?array $data = [];



public function form(Form $form): Form
{
return $form
->statePath('data')
->schema([
Grid::make(2)
->schema([
TextInput::make("keyword")
->default(2)
->required(),
])

]);
}

public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make("name"),
TextColumn::make("email"),
TextColumn::make("body"),
])
->filters([])
->actions([])
->bulkActions([])
->query(TargetFinder::query());
}


public function fetchApiData()
{
$this->selected = [];
(new TargetFinder)->getRows($this->data);
}
}
Thank you
5 replies
FFilament
Created by mohdaftab on 8/23/2024 in #❓┊help
DateTimePicker showing seconds with minDate
No description
12 replies
FFilament
Created by mohdaftab on 8/16/2024 in #❓┊help
Replication causes 500 internal server error
Hello, I am using Replication with filament-fabricator and was facing this issue on production server whenever we created a replica page I made it redirect to the edit page but it always gave me 500 server error because the newly created page id was not found in routes somehow. I figured I always had to run php artisan optimize:clear command to make that page work so I created an observer to run this command everytime the page is created and it works ok but some times the optimize doesn't work and my client gets 500 server error. Please let me know if any of you have faced this situation on production server? Also please let me know how do I fix this issue on production server? The local server works great without any commands. Thank you
5 replies
FFilament
Created by mohdaftab on 8/15/2024 in #❓┊help
How do I close Action modal using $wire when process is done
No description
49 replies
FFilament
Created by mohdaftab on 8/13/2024 in #❓┊help
How to disable create button on Wizard's last step using Alpine?
Hello, I have a 2 step wizard which I am using to add card details for Stripe. Step one takes the card details and goes to step two to submit the form. But before submitting the form I need to disable the create button and as soon as the Step two loads I need to send the Step one data (card details) to Stripe JS to receive the token that I want to set as value for Step two's hidden field named card_token. Once the card_token field is filled I need to enable the Create button to submit the form. Please let me know how to do that? I am struggling to make this work. Thank you so much.
3 replies
FFilament
Created by mohdaftab on 8/13/2024 in #❓┊help
How to add card details and generate stripe token using Relation manager form?
Hello, I am using stripe-php to add card information to Stripe and using card details relation manager for customers. I am able to add the card details in the self hosted form but Stripe requires us to generate token by sending card details using their Javascript api which I can send by dispatching the Livewire event but I am not able to set the value for the token field with the class card_token on the form after getting response from Stripe. Please let me know how can I generate the token, validate it and set the token as value for card_token textinput before submitting the form. Thank you
6 replies
FFilament
Created by mohdaftab on 8/2/2024 in #❓┊help
Use form builder and table builder on front-end
Hello, I am trying to add Filament Form and Table in a Livewire component to use on front-end which but I need to import all the styles and scripts that the dashboard uses please as the form and table are not functioning properly if I am using external Tailwindcss styles. Please let me know how can I make this work. Thank you
5 replies
FFilament
Created by mohdaftab on 7/28/2024 in #❓┊help
extraFieldWrapperAtrributes class display hide using AlpineJs
No description
2 replies
FFilament
Created by mohdaftab on 7/27/2024 in #❓┊help
How to populate select list options without pre-selecting them?
Hello, I am using hintAction withi the Select option to populate the options in my Select (multiple,searchable) input and it loads the lists but auto selects all the options as well. Please let me know how can I just load the options to the list without selecting any of them? Thank you
25 replies
FFilament
Created by mohdaftab on 7/26/2024 in #❓┊help
Repeater requiredIf validation from the field outside of repeater
Hello, I am trying to make requiredUnless if the TextInput (outside of Repeater) has a certain value but it doesn't work, Please let me know how can I make this validation work? Repeater::make("passenger_details") ->grid(2) ->schema([ TextInput::make("first_name") ->requiredUnless('passenger_type', 'self'), TextInput::make("last_name") ->requiredUnless('passenger_type', 'self'), TextInput::make("email") ->email(), TextInput::make("phone") ->tel(), ]) Also I tried $get('passenger_type') inside the repeater and the passenger_type input is outside of the repeater. Thank you
8 replies
FFilament
Created by mohdaftab on 7/24/2024 in #❓┊help
Loosing a really good project because of the slowness in loading components
How can we make the input fields hide/show conditionally without sending requests to the server? I am developing a car booking project and there my client wants to use the form which loads the form components quickly like we use javascript to show/hide input fields which is much faster than FilamentPHP sending request to server and render it again. I am using a Repeater with displays conditionally but it is quite slow like it takes 1.2 to 1.5 seconds to load even for a fresh project in production. Also the conditional input fields load slow as compared to the project (angular project) client is currently using and he says the speed is the main part of this form. Please let me know how can I make the components show/hide dynamically based on other form inputs but not send requests to server at all. Thank you
43 replies
FFilament
Created by mohdaftab on 7/19/2024 in #❓┊help
Dynamically update rules based on Select option
No description
3 replies
FFilament
Created by mohdaftab on 7/16/2024 in #❓┊help
Multi tenancy sub-domain redirection problem
Hello, I have multiple tenants attached to a user and I am using wildcard subdomains for each tenant url. Everything works good but the issue with redirection after logging in has a little problem which I think should be an easy fix but I am struggling to figure it out. Here are the details: User is attached to 2 tenants with slugs company-1 and company-2 subdomain is company-1.domain.com and company-2.domain.com I have setup default tenant and latest tenant in User model. so the issue is when a user tries to login using company-2.domain.com they get redirected to company-1.domain.com/dashboard where user has to switch to company 2 to access it. I need a solution to redirect user to the same subdomain which they used to login. Thank you so much in advance.
26 replies
FFilament
Created by mohdaftab on 7/15/2024 in #❓┊help
How to separate a resource from Tenants
No description
16 replies
FFilament
Created by mohdaftab on 7/8/2024 in #❓┊help
How to display the users separately in the table row
No description
8 replies
FFilament
Created by mohdaftab on 7/5/2024 in #❓┊help
Spatie Roles and Permissions package with Multi-Tenancy
No description
34 replies
FFilament
Created by mohdaftab on 4/12/2024 in #❓┊help
Hello, how do I make Relation Manager form use full width of the page please?
Hello, I am using Relation Manager to add records. I need to display the form modal in full width, please let me know how do I do that? Thank you
4 replies
FFilament
Created by mohdaftab on 2/27/2024 in #❓┊help
ReplicateAction with uniqid() as slug giving error
Hello, I have extended my Page model and PageResource to add is_published and a few other custom fields. I have also added globalscope to not display pages with is_published = 0 for non authenticated users. My client asked me to add a ReplicateAction but since each page has a slug so I had to use beforeReplicaSaved to create uniqid() as slug and it creates the new page with all the details but when it redirects to edit page it gives me this error "Undefined array key 21" whereas 21 is the auto-increment id. Below is the code I am using in table actions. Please let me know how do I fix this? Thank you ReplicateAction::make() ->beforeReplicaSaved(function (Model $replica): void { $replica->slug = uniqid(); $replica->is_published = 0; }) ->successRedirectUrl(function (Model $replica) { return route('filament.dashboard.resources.pages.edit', $replica->id); }),
5 replies
FFilament
Created by mohdaftab on 2/6/2024 in #❓┊help
FileUpload imageEditor replace instead of adding v1, v2 to the file
Hello, I am uploading images using FileUpload and I have added the imageEditor option and it works great but it automatically adds -v1 -v2 to the filenames created by the editor. I would like to ask if it is possible to replace the existing file instead of creating the new one? Thank you
17 replies
FFilament
Created by mohdaftab on 2/6/2024 in #❓┊help
BelongsToMany TextColumn first_name last_name searchable
No description
7 replies