Image not showing on table column

Hi, i just trying to create a product crud with image upload inside. The image was uploaded in /storage/public/product, but not showing in my table
Forms\Components\FileUpload::make('foto')
->image()
->directory('product')
->required(),
Forms\Components\FileUpload::make('foto')
->image()
->directory('product')
->required(),
Tables\Columns\ImageColumn::make('foto'),
Tables\Columns\ImageColumn::make('foto'),
$table->string('foto')->nullable();
$table->string('foto')->nullable();
32 Replies
LeandroFerreira
did you run php artisan storage:link? did you config APP_URL in the .env? console errors?
sneevilz
sneevilz2w ago
storage:link is already, config APP_URL? mine is https://127.0.0.1:8000 no console error
LeandroFerreira
could you show a screenshot?
sneevilz
sneevilz2w ago
No description
No description
No description
No description
No description
LeandroFerreira
could you share the code?
sneevilz
sneevilz2w ago
sure
LeandroFerreira
add this tooltip
Tables\Columns\ImageColumn::make('foto')
->tooltip(fn (string $state): string => $state)
Tables\Columns\ImageColumn::make('foto')
->tooltip(fn (string $state): string => $state)
what is showing on the tooltip?
sneevilz
sneevilz2w ago
lemme try
sneevilz
sneevilz2w ago
that's give me error
No description
LeandroFerreira
there is no state from foto column. Are you sure that is the column name? Any Filament customizations?
sneevilz
sneevilz2w ago
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('barangs', function (Blueprint $table) {
$table->id();
$table->string('foto')->nullable();
$table->string('kode')->unique();
$table->string('nama');
$table->string('kategori');
$table->decimal('harga_beli' ,10,2);
$table->decimal('harga_jual' ,10,2);
$table->integer('stok');
$table->integer('diskon');
$table->string('tipe_barang')->default('default');
$table->string('satuan');
$table->integer('berat');
$table->integer('letak_rak');
$table->string('keterangan')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('barangs');
}
};
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('barangs', function (Blueprint $table) {
$table->id();
$table->string('foto')->nullable();
$table->string('kode')->unique();
$table->string('nama');
$table->string('kategori');
$table->decimal('harga_beli' ,10,2);
$table->decimal('harga_jual' ,10,2);
$table->integer('stok');
$table->integer('diskon');
$table->string('tipe_barang')->default('default');
$table->string('satuan');
$table->integer('berat');
$table->integer('letak_rak');
$table->string('keterangan')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('barangs');
}
};
whats wrong?
LeandroFerreira
this seems like you don't have foto column in this model/resource 😅 Are you able to share this project on github? could you share Barang model?
sneevilz
sneevilz2w ago
umm model?
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Barang extends Model
{
use HasFactory;

protected $guarded = [
'id',
'foto',
];
}
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Barang extends Model
{
use HasFactory;

protected $guarded = [
'id',
'foto',
];
}
sure
LeandroFerreira
Tables\Columns\ImageColumn::make('foto')
->tooltip(fn (Barang $record): string => $record->foto)
Tables\Columns\ImageColumn::make('foto')
->tooltip(fn (Barang $record): string => $record->foto)
what is the tooltip?
Want results from more Discord servers?
Add your server