Sourabh
Sourabh
FFilament
Created by Sourabh on 2/10/2025 in #❓┊help
Cursor Pagination Not Working with Filament Table Tabs
No description
8 replies
FFilament
Created by Sourabh on 1/16/2025 in #❓┊help
How to include external js in the filament render hook?
I’ve created a Filament render hook and passed a Livewire component inside it. Now, I want to implement drag-and-drop functionality for the table rows in the Livewire component. I’m using livewire-sortable.js for this, but it’s not working as expected. Could someone guide me on the correct placement of the livewire-sortable.js CDN to avoid unexpected errors, loading issues, or UI problems in Filament?
<?php
//AppServiceProvider.php
public function boot(): void
{
FilamentView::registerRenderHook(
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
fn (): string => Blade::render('@livewire(\'products.product-cart\')')
);
}
?>
<?php
//AppServiceProvider.php
public function boot(): void
{
FilamentView::registerRenderHook(
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
fn (): string => Blade::render('@livewire(\'products.product-cart\')')
);
}
?>
<?php
//product-cart.blade.php
<div>
//code here
</div>
@livewireScripts
<script src="https://cdn.jsdelivr.net/gh/livewire/[email protected]/dist/livewire-sortable.js" defer></script>

?>
<?php
//product-cart.blade.php
<div>
//code here
</div>
@livewireScripts
<script src="https://cdn.jsdelivr.net/gh/livewire/[email protected]/dist/livewire-sortable.js" defer></script>

?>
2 replies
FFilament
Created by Sourabh on 1/1/2025 in #❓┊help
Test Filament Email Verification.
I want to test filament email verification by Pest, and I have created a separate MySQL testing database along with the .env.testing environment. When I run the test case, the email verification notification is not received on user email id. Please find below code for your reference.
<?php
test('sends the filament email verification notification after registering', function () {
Notification::fake();
$response = Livewire(Register::class)
->fillForm([
'name' => 'App User',
'company_name' => 'Company Name',
'email' => '[email protected]',
'password' => 'password',
'passwordConfirmation' => 'password',
])

->call('register')
->assertHasNoFormErrors();

$user = User::where('email', '[email protected]')->firstOrFail();

Notification::assertSentTo([$user], VerifyEmail::class);
});

?>
<?php
test('sends the filament email verification notification after registering', function () {
Notification::fake();
$response = Livewire(Register::class)
->fillForm([
'name' => 'App User',
'company_name' => 'Company Name',
'email' => '[email protected]',
'password' => 'password',
'passwordConfirmation' => 'password',
])

->call('register')
->assertHasNoFormErrors();

$user = User::where('email', '[email protected]')->firstOrFail();

Notification::assertSentTo([$user], VerifyEmail::class);
});

?>
//.env.testing
<?php
APP_NAME="laravel"
APP_ENV=testing
APP_KEY=base64:UzY9zi19NQxvCu0j8aqCpsg2VK6jDrhynKGGEzPoHzY=
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000/


DB_CONNECTION=testing
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=riview_app_testing
DB_USERNAME=root
DB_PASSWORD=tops12345

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120

MAIL_MAILER=smtp
MAIL_HOST=smtp-relay.brevo.com
MAIL_PORT=465
MAIL_PASSWORD="password"
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
?>
<?php
APP_NAME="laravel"
APP_ENV=testing
APP_KEY=base64:UzY9zi19NQxvCu0j8aqCpsg2VK6jDrhynKGGEzPoHzY=
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000/


DB_CONNECTION=testing
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=riview_app_testing
DB_USERNAME=root
DB_PASSWORD=tops12345

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120

MAIL_MAILER=smtp
MAIL_HOST=smtp-relay.brevo.com
MAIL_PORT=465
MAIL_PASSWORD="password"
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
?>
3 replies
FFilament
Created by Sourabh on 12/3/2024 in #❓┊help
Custom page external CSS and JS
How do I include external Slick Carousel CSS and JS in the Filament custom page? I have used it directly in a custom filament page, and it is working. I want to know what is the right approach to include CSS and JS of the external Slick JS library so that I can not get a CSS and JS conflict issue. I tried the following code in AppServiceProvider.php, but it does not seem to be working.
<?php
//Register css assets

FilamentAsset::register([
asset('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css'),
asset('https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css'),
asset('https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css'),
]);

// Register JavaScript assets
FilamentAsset::register([
asset('https://code.jquery.com/jquery-3.6.0.min.js'),
asset('https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js'),
]);

?>
<?php
//Register css assets

FilamentAsset::register([
asset('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css'),
asset('https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css'),
asset('https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css'),
]);

// Register JavaScript assets
FilamentAsset::register([
asset('https://code.jquery.com/jquery-3.6.0.min.js'),
asset('https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js'),
]);

?>
6 replies
FFilament
Created by Sourabh on 10/16/2024 in #❓┊help
How do apply css on modal submit Action
No description
6 replies
FFilament
Created by Sourabh on 10/14/2024 in #❓┊help
Filament Registration page
No description
4 replies
FFilament
Created by Sourabh on 9/27/2024 in #❓┊help
How do i set default image in FileUpload ?
How do I set the default image in the fileupload form component? or can i show the default image while file upload ?
<?php
Forms\Components\FileUpload::make('company_logo')
->label('Company Logo')
->image()
->required()
->rules([
'image',
'mimes:jpeg,png,jpg',
'max:2048',
'dimensions:max_width=300,max_height=200',
])
->default(fn ($record) => $record && $record->company_logo ? $record->company_logo : asset('/images/company_logo.png')
->disk('company_logo') // from filesystems.php
->maxFiles(1)

?>
<?php
Forms\Components\FileUpload::make('company_logo')
->label('Company Logo')
->image()
->required()
->rules([
'image',
'mimes:jpeg,png,jpg',
'max:2048',
'dimensions:max_width=300,max_height=200',
])
->default(fn ($record) => $record && $record->company_logo ? $record->company_logo : asset('/images/company_logo.png')
->disk('company_logo') // from filesystems.php
->maxFiles(1)

?>
I have also try
<?php
->defaultImageUrl(asset('/images/company_logo.png'))
?>
<?php
->defaultImageUrl(asset('/images/company_logo.png'))
?>
5 replies
FFilament
Created by Sourabh on 9/5/2024 in #❓┊help
Open the custom page in a new browser tab.
No description
3 replies
FFilament
Created by Sourabh on 8/27/2024 in #❓┊help
Filament Table tab
No description
21 replies
FFilament
Created by Sourabh on 8/22/2024 in #❓┊help
import Action method examples does not exist.
I'm trying to add multiple examples to the CSV file, but I'm getting an error saying 'method examples does not exist.' Please find below the flare link and attachment of my code .
<?php
ImportColumn::make('sku')
->label('SKU')
->exampleHeader('SKU')
->examples(['ABC123', 'DEF456']),?>
<?php
ImportColumn::make('sku')
->label('SKU')
->exampleHeader('SKU')
->examples(['ABC123', 'DEF456']),?>
11 replies
FFilament
Created by Sourabh on 8/21/2024 in #❓┊help
Import csv data
How can I import data from an Excel or CSV file when the field does not exist in the model or database table? But still, i need to keep the custom field in import csv file because i am using that field for my internal calculations and rectifying records. so that field is not to be imported into the table . Here, my custom field is sku . I have shared my code in the attachment.
3 replies
FFilament
Created by Sourabh on 7/31/2024 in #❓┊help
Modal Blade component background not showing transparent.
No description
17 replies
FFilament
Created by Sourabh on 7/31/2024 in #❓┊help
Modal Sticky Footer livewire component
No description
2 replies
FFilament
Created by Sourabh on 6/11/2024 in #❓┊help
Custom form field
No description
15 replies
FFilament
Created by Sourabh on 6/10/2024 in #❓┊help
Table custom filter validate
No description
7 replies
FFilament
Created by Sourabh on 6/7/2024 in #❓┊help
Table Layout
No description
3 replies
FFilament
Created by Sourabh on 5/17/2024 in #❓┊help
Table Custom Column Update.
No description
8 replies
FFilament
Created by Sourabh on 5/17/2024 in #❓┊help
Access Relationship Data in Table Layout Custom HTML
How to access relationship data in Table Layout: Custom HTML. I have products and I want to show their variants in the custom HTML. https://filamentphp.com/docs/3.x/tables/layout#custom-html
<?php
//Product Model
public function variants(): HasMany
{
return $this->hasMany(ProductVariant::class);
}
<?php
//Product Model
public function variants(): HasMany
{
return $this->hasMany(ProductVariant::class);
}
```<?php
// ProductResource.php
View::make('products.table.collapsible-row-content')
->collapsible(),
```<?php
// ProductResource.php
View::make('products.table.collapsible-row-content')
->collapsible(),
<?php
// I try below code in the blade file.
// resources/views/products/table/collapsible-row-content.blade.php
<p class="px-4 py-3 bg-gray-100 rounded-lg">
<span class="font-medium">
@foreach($getRecord()->variants() as $productVariant)
<p>{{$productVariant->description}}</p>
@endforeach
</span>
</p>
<?php
// I try below code in the blade file.
// resources/views/products/table/collapsible-row-content.blade.php
<p class="px-4 py-3 bg-gray-100 rounded-lg">
<span class="font-medium">
@foreach($getRecord()->variants() as $productVariant)
<p>{{$productVariant->description}}</p>
@endforeach
</span>
</p>
3 replies
FFilament
Created by Sourabh on 5/8/2024 in #❓┊help
Table row: expand/collapse
No description
7 replies
FFilament
Created by Sourabh on 5/6/2024 in #❓┊help
Dropdown in csv import
No description
2 replies