filament fixing image path

im new in filamennt, i want to show images in storage, but the path goes with image path like this:
http://127.0.0.1:8000/admin/127.0.0.1:8000/storage/01JDNP8T1Q25Q4S8ARS96QDN3Z.png
http://127.0.0.1:8000/admin/127.0.0.1:8000/storage/01JDNP8T1Q25Q4S8ARS96QDN3Z.png
i done link my storage, but why that say 404 not found
No description
No description
No description
Solution:
yeah you can try
Jump to solution
22 Replies
Kang Baso
Kang BasoOP5d ago
sorry for my english
Vp
Vp5d ago
check app_url in .env, it needs port eg: APP_URL=http://localhost:8000
Kang Baso
Kang BasoOP5d ago
i done doing that, but nothing change
Vp
Vp5d ago
w8, your url http://127.0.0.1:8000/admin/127.0.0.1:8000/storage/01JDNP8T1Q25Q4S8ARS96QDN3Z.png is very weird.. show me how you upload and did you put 127.0... insted of localhost ?
Kang Baso
Kang BasoOP5d ago
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')
->label('Name')
->required(),
Forms\Components\Textarea::make('description')
->label('Description'),
Forms\Components\TextInput::make('price')
->label('Price')
->numeric()
->required(),
Forms\Components\FileUpload::make('thumbnail')
->label('Thumbnail'),
Forms\Components\Repeater::make('photos')
->relationship('photos')
->schema([
Forms\Components\FileUpload::make('images')
->label('Photos'),
]),
Forms\Components\Toggle::make('is_avaible')
->label('Is Available')
->default(true),
]);
}
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')
->label('Name')
->required(),
Forms\Components\Textarea::make('description')
->label('Description'),
Forms\Components\TextInput::make('price')
->label('Price')
->numeric()
->required(),
Forms\Components\FileUpload::make('thumbnail')
->label('Thumbnail'),
Forms\Components\Repeater::make('photos')
->relationship('photos')
->schema([
Forms\Components\FileUpload::make('images')
->label('Photos'),
]),
Forms\Components\Toggle::make('is_avaible')
->label('Is Available')
->default(true),
]);
}
this my model:
class Menu extends Model
{
protected $fillable = [
'name',
'description',
'price',
'is_avaible',
'thumbnail'
];

public function photos()
{
return $this->hasMany(MenuPhoto::class);
}

public function orderItems()
{
return $this->morphMany(OrderItem::class, 'item');
}

public function packages()
{
return $this->belongsToMany(package::class, 'package_menus')->withPivot('quantity')->withTimestamps();
}
}
class Menu extends Model
{
protected $fillable = [
'name',
'description',
'price',
'is_avaible',
'thumbnail'
];

public function photos()
{
return $this->hasMany(MenuPhoto::class);
}

public function orderItems()
{
return $this->morphMany(OrderItem::class, 'item');
}

public function packages()
{
return $this->belongsToMany(package::class, 'package_menus')->withPivot('quantity')->withTimestamps();
}
}
Vp
Vp5d ago
did you do this? Did you setup something differently because /admin/127.0.0.1:8000/storage... is very weird, based on the upload you should've /admin/storage...
Kang Baso
Kang BasoOP5d ago
no i didnt setting anything in my database that column just containt file name hm where i can put log to see where what image path, i want to try change the image to see that
Vp
Vp5d ago
remove 127.0... between admin and storage and check on browser, does it display image?
Kang Baso
Kang BasoOP5d ago
no, i try all path, and the true path is http://127.0.0.1:8000/storage/01JDNRW7DXKSYENEXDVCGJVG8N.png
Vp
Vp5d ago
oh.. yes it should be without admin and 127.0..
Kang Baso
Kang BasoOP5d ago
but see, in this the path is true
No description
Kang Baso
Kang BasoOP5d ago
are that error from my filesystem.php file?
Vp
Vp5d ago
here it missing http:// maybe that's why what did you put in app_url in .env file?
Kang Baso
Kang BasoOP5d ago
No description
Kang Baso
Kang BasoOP5d ago
are i need to clear cache?
Solution
Vp
Vp5d ago
yeah you can try
Vp
Vp5d ago
now I am out of idea.. what are your filament and laravel versions?
Kang Baso
Kang BasoOP5d ago
3.2
Vp
Vp5d ago
run php artisan about and post the exact version
Kang Baso
Kang BasoOP5d ago
php artisan about

Environment ...................................................................................................
Application Name ...................................................................................... Laravel
Laravel Version ....................................................................................... 11.34.0
PHP Version ............................................................................................ 8.2.12
Composer Version ........................................................................................ 2.8.2
Environment ............................................................................................. local
Debug Mode ............................................................................................ ENABLED
URL ............................................................................................ 127.0.0.1:8000
Maintenance Mode .......................................................................................... OFF
Timezone .................................................................................................. UTC
Locale ..................................................................................................... en

Cache .........................................................................................................
Config ............................................................................................. NOT CACHED
Events ............................................................................................. NOT CACHED
Routes ............................................................................................. NOT CACHED
Views .................................................................................................. CACHED

Drivers .......................................................................................................
Broadcasting .............................................................................................. log
Cache ................................................................................................ database
Database ................................................................................................ mysql
Logs ........................................................................................... stack / single
Mail ...................................................................................................... log
Queue ................................................................................................ database
Session .............................................................................................. database

Filament ......................................................................................................
Blade Icons ........................................................................................ NOT CACHED
Packages ...................................................... filament, forms, notifications, support, tables
Panel Components ................................................................................... NOT CACHED
Version .............................................................................................. v3.2.124
Views ........................................................................................... NOT PUBLISHED

Livewire ......................................................................................................
Livewire .............................................................................................. v3.5.12
php artisan about

Environment ...................................................................................................
Application Name ...................................................................................... Laravel
Laravel Version ....................................................................................... 11.34.0
PHP Version ............................................................................................ 8.2.12
Composer Version ........................................................................................ 2.8.2
Environment ............................................................................................. local
Debug Mode ............................................................................................ ENABLED
URL ............................................................................................ 127.0.0.1:8000
Maintenance Mode .......................................................................................... OFF
Timezone .................................................................................................. UTC
Locale ..................................................................................................... en

Cache .........................................................................................................
Config ............................................................................................. NOT CACHED
Events ............................................................................................. NOT CACHED
Routes ............................................................................................. NOT CACHED
Views .................................................................................................. CACHED

Drivers .......................................................................................................
Broadcasting .............................................................................................. log
Cache ................................................................................................ database
Database ................................................................................................ mysql
Logs ........................................................................................... stack / single
Mail ...................................................................................................... log
Queue ................................................................................................ database
Session .............................................................................................. database

Filament ......................................................................................................
Blade Icons ........................................................................................ NOT CACHED
Packages ...................................................... filament, forms, notifications, support, tables
Panel Components ................................................................................... NOT CACHED
Version .............................................................................................. v3.2.124
Views ........................................................................................... NOT PUBLISHED

Livewire ......................................................................................................
Livewire .............................................................................................. v3.5.12
thanks for your help, i found my error. i just clear all cache from app folder and boom the image is show this is the fucking error, i had this error for 6 hour lol
Kang Baso
Kang BasoOP5d ago
im so sorry for my english
Vp
Vp5d ago
glad it's resolved
Want results from more Discord servers?
Add your server