Sanchit Patil
Sanchit Patil
FFilament
Created by Sanchit Patil on 10/8/2024 in #❓┊help
Persist current tab while using Tabs Blade component
For those who are looking for this solution, There is no direct filament way to do this, you need some manual alpine to make this work. in page class,
public function mount(int|string $record): void
{
$this->record = $this->resolveRecord($record);

//Add this code
if (request()->has('tab')) {
$this->activeTab = request('tab');
}
}
public function mount(int|string $record): void
{
$this->record = $this->resolveRecord($record);

//Add this code
if (request()->has('tab')) {
$this->activeTab = request('tab');
}
}
in the view file,
<div class="rounded-lg lg:col-span-2" x-data="{
activeTab: @entangle('activeTab'),
updateUrl() {
const url = new URL(window.location.href);
url.searchParams.set('tab', this.activeTab);
history.pushState(null, '', url);
}
}"
x-init="$watch('activeTab', () => updateUrl());">
<div class="rounded-lg lg:col-span-2" x-data="{
activeTab: @entangle('activeTab'),
updateUrl() {
const url = new URL(window.location.href);
url.searchParams.set('tab', this.activeTab);
history.pushState(null, '', url);
}
}"
x-init="$watch('activeTab', () => updateUrl());">
4 replies
FFilament
Created by Sanchit Patil on 3/22/2024 in #❓┊help
Error with FileUpload in Livewire nested component
async-alpine was causing this issue. I have loaded this wrapper externally into my app layout file, working perfectly after removing this. https://github.com/Accudio/async-alpine
5 replies
FFilament
Created by Sanchit Patil on 3/22/2024 in #❓┊help
Error with FileUpload in Livewire nested component
No description
5 replies
FFilament
Created by Sanchit Patil on 3/5/2024 in #❓┊help
Font used in Filament
perfect, thank you 🙂
6 replies
FFilament
Created by Sanchit Patil on 12/6/2023 in #❓┊help
Max Selectable Options in Checkbox List
Thanks a lot, mate. this works like a charm. For those who are looking for a similar kinda solution:
->afterStateUpdated(function (HasForms $livewire, CheckboxList $component) {
$livewire->validateOnly($component->getStatePath());
})
->disableOptionWhen(function (Get $get, string $value){
$c = $get('courses');
if(count($c) >= $this->product->automation->shop_trigger_automation['quantity']){
if(!in_array($value,$c)){
return true;
}
}
})
->afterStateUpdated(function (HasForms $livewire, CheckboxList $component) {
$livewire->validateOnly($component->getStatePath());
})
->disableOptionWhen(function (Get $get, string $value){
$c = $get('courses');
if(count($c) >= $this->product->automation->shop_trigger_automation['quantity']){
if(!in_array($value,$c)){
return true;
}
}
})
10 replies
FFilament
Created by Sanchit Patil on 12/6/2023 in #❓┊help
Max Selectable Options in Checkbox List
thank you for your reply I can validate it but after the button click what I want is when the user selects 5 options, all other options should get disabled.
10 replies
FFilament
Created by Sanchit Patil on 9/28/2023 in #❓┊help
Passing parameters to a custom page
are you getting this issue due to the custom page? because I got this issue while trying to pass a parameter to the custom page URL. first, i tried the way we do it with Livewire full-page component
Route::get('/trainer/attendee-sheet/{id}', \App\Filament\Trainer\Pages\AttendeeSheet::class)
->name('filament.trainer.pages.attendee-sheet');
Route::get('/trainer/attendee-sheet/{id}', \App\Filament\Trainer\Pages\AttendeeSheet::class)
->name('filament.trainer.pages.attendee-sheet');
php this works but, the filament started showing the Admin panel's menu when I sent the parameter (the page is not associated with the admin panel). so tried it in the getSlug function and accessed in the mount function and it worked.
8 replies
FFilament
Created by Chriis on 11/7/2023 in #❓┊help
Get the active tab
Oh yes, sorry my bad. not sure how to update this between the states if we do something like this on the ListRecords page
public string $activetab = 'none';
public function mount(): void
{
$this->activetab = request()->query('activeTab');
}
public string $activetab = 'none';
public function mount(): void
{
$this->activetab = request()->query('activeTab');
}
not sure how to access activetab in the Resource class.
22 replies
FFilament
Created by Chriis on 11/7/2023 in #❓┊help
Get the active tab
something like this?
Tables\Actions\EditAction::make()->hidden(function (){
return ((request()->query('activeTab') === 'archived'));
}),
Tables\Actions\EditAction::make()->hidden(function (){
return ((request()->query('activeTab') === 'archived'));
}),
22 replies
FFilament
Created by John Parker on 10/18/2023 in #❓┊help
Updating Form Field data from JavaScript
following.. I am in the same same boat. what I am doing currently is, (not happy at all with this though)
let fieldInput = document.querySelector('.fieldclass');
fieldInput.value = datatoupdate;
fieldInput.dispatchEvent(new Event('input'));
let fieldInput = document.querySelector('.fieldclass');
fieldInput.value = datatoupdate;
fieldInput.dispatchEvent(new Event('input'));
3 replies
FFilament
Created by Morpheus on 10/17/2023 in #❓┊help
development subdomain
php artisan optimize:clear ?
11 replies
FFilament
Created by Leonel López on 10/16/2023 in #❓┊help
After form submission, data insertion is blocked due to an array issue related to marked checkboxes
what is your column's name? you have added videos in the cast but using video_id in schema it should be video_id in casts too. (assuming the column name is video_id & column type text or json)
7 replies
FFilament
Created by Mehmet K. on 10/16/2023 in #❓┊help
I wonder why this error occurs?
change filament version to ^3.0-stable in composer.json and composer update
10 replies
FFilament
Created by Mehmet K. on 10/16/2023 in #❓┊help
I wonder why this error occurs?
As far as I know, this error occurred when you are using an old version of filamentphp can try composer update -W
10 replies
FFilament
Created by Leonel López on 10/16/2023 in #❓┊help
After form submission, data insertion is blocked due to an array issue related to marked checkboxes
No description
7 replies
FFilament
Created by Mehmet K. on 10/16/2023 in #❓┊help
I wonder why this error occurs?
I resolved this error in my project with these steps, 1) Make sure your composer.json file has this filament version -> "filament/filament": "^3.0-stable", now run the composer update, It might resolve the issue or else 2) Remove composer.lock & delete entire vendor directory 3) run composer install
10 replies
FFilament
Created by Pasteko on 10/13/2023 in #❓┊help
Shared hosting deployment
it will go inside your panel provider. for e.g. AdminPanelProvider.php
public function boot(): void
{
Livewire::setScriptRoute(function ($handle) {
return Route::get('/custom/livewire/livewire.js', $handle);
});
}
public function boot(): void
{
Livewire::setScriptRoute(function ($handle) {
return Route::get('/custom/livewire/livewire.js', $handle);
});
}
5 replies
FFilament
Created by Chriis on 10/5/2023 in #❓┊help
$get('foo') return an id in a 1-n relationship field
this should be used only for edit method
13 replies
FFilament
Created by Chriis on 10/5/2023 in #❓┊help
$get('foo') return an id in a 1-n relationship field
have you loaded the model? use App\Models\Sheet
13 replies
FFilament
Created by Chriis on 10/5/2023 in #❓┊help
$get('foo') return an id in a 1-n relationship field
->afterStateUpdated(function($get,$set, YourModel $record){
$getters = [
'course' => $record->relationship->field_name,
];
}
->afterStateUpdated(function($get,$set, YourModel $record){
$getters = [
'course' => $record->relationship->field_name,
];
}
this might help.
13 replies