ImageColumn::make('logo') had no explicit disk, so it defaulted to
Filament's local disk while uploads write to the public disk,
causing the file-existence check to fail and the src to render
empty. Align the column's disk with the upload field's disk.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015HaT8a5ZWh45JkjTLPWeaP
This commit is contained in:
@@ -18,6 +18,7 @@ class EvCompaniesTable
|
|||||||
return $table
|
return $table
|
||||||
->columns([
|
->columns([
|
||||||
ImageColumn::make('logo')
|
ImageColumn::make('logo')
|
||||||
|
->disk('public')
|
||||||
->circular(),
|
->circular(),
|
||||||
TextColumn::make('name')
|
TextColumn::make('name')
|
||||||
->searchable()
|
->searchable()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Livewire\Livewire;
|
use Livewire\Livewire;
|
||||||
use Modules\Catalog\Filament\Resources\EvCompanies\Pages\CreateEvCompany;
|
use Modules\Catalog\Filament\Resources\EvCompanies\Pages\CreateEvCompany;
|
||||||
@@ -26,6 +27,17 @@ test('can list ev companies', function () {
|
|||||||
->assertCanSeeTableRecords($companies);
|
->assertCanSeeTableRecords($companies);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('renders the logo from the public disk in the table', function () {
|
||||||
|
Storage::fake('public');
|
||||||
|
Storage::disk('public')->put('logos/example.png', 'fake-image-contents');
|
||||||
|
|
||||||
|
$company = EvCompany::factory()->create(['logo' => 'logos/example.png']);
|
||||||
|
|
||||||
|
Livewire::test(ListEvCompanies::class)
|
||||||
|
->assertOk()
|
||||||
|
->assertSee(Storage::disk('public')->url($company->logo), escape: false);
|
||||||
|
});
|
||||||
|
|
||||||
test('can create an ev company', function () {
|
test('can create an ev company', function () {
|
||||||
$company = EvCompany::factory()->make();
|
$company = EvCompany::factory()->make();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user