vendredi 20 décembre 2019

File Link is not wok in laravel on localhost http://127.0.0.1:8000

I am using php artisan serve to serve on local host http://127.0.0.1:8000 , then files I upload surely exist in storage folder but when I am creating links like:

 public function getFeaturedImageLinkAttribute()
{
    $file = $this->getFirstMedia('featured_image');
    if (! $file) {
        return null;
    }

    return '<a href="' . $file->getUrl() . '" target="_blank">' . $file->file_name . '</a>';
}

 public function getUrl(string $conversionName = ''): string
{
    $urlGenerator = UrlGeneratorFactory::createForMedia($this, $conversionName);

    return $urlGenerator->getUrl();
}

links I get is like : http://127.0.0.1/storage/6/image.jpg

which is not woking but when I do : http://127.0.0.1:8000/storage/6/image.jpg it works so my question is how to make my links work?

.env file:

APP_URL=http://127.0.0.12:8000



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire