Laravel 8用户配置文件甚至不显示按钮或alt图像

dkqlctbz  于 2022-11-26  发布在  其他
关注(0)|答案(1)|浏览(169)

我试图查看/更改一个用户的个人资料图片,但我似乎不能正确地这样做,因此没有显示任何东西,因为我刚刚开始使用Laravel创建一个页面。我可以看到其他教程在他们的个人资料页面中有个人资料图片,但当它来到我这里,这是唯一的东西正在显示[它看起来像] (https://i.stack.imgur.com/00nyo.png),即使我还没有做任何的代码在个人资料中。
我试着改变**APP_URL=http://127.0.0.1:8000*****php artisan storage:link***,并删除**jetstream**中的功能注解,但似乎没有任何效果。下面是个人资料照片的代码,我应该怎么做或修复?我还不太擅长使用Laravel框架

<x-slot name="form">
        <!-- Profile Photo -->
        @if (Laravel\Jetstream\Jetstream::managesProfilePhotos())
            <div x-data="{photoName: null, photoPreview: null}" class="col-span-6 sm:col-span-4">
                <!-- Profile Photo File Input -->
                <input type="file"
                            wire:model="photo"
                            x-ref="photo"
                            x-on:change="
                                    photoName = $refs.photo.files[0].name;
                                    const reader = new FileReader();
                                    reader.onload = (e) => {
                                        photoPreview = e.target.result;
                                    };
                                    reader.readAsDataURL($refs.photo.files[0]);
                            " />

                <x-jet-label for="photo" value="{{ __('Photo') }}" />

                <!-- Current Profile Photo -->
                <div class="mt-2" x-show="! photoPreview">
                    <img src="{{ $this->user->profile_photo_url }}" alt="{{ $this->user->name }}" class="rounded-full h-20 w-20 object-cover">
                </div>

                <!-- New Profile Photo Preview -->
                <div class="mt-2" x-show="photoPreview" style="display: none;">
                    <span class="block rounded-full w-20 h-20 bg-cover bg-no-repeat bg-center"
                          x-bind:style="'background-image: url(\'' + photoPreview + '\');'">
                    </span>
                </div>

                <x-jet-secondary-button class="mt-2 mr-2" type="button" x-on:click.prevent="$refs.photo.click()">
                    {{ __('Select A New Photo') }}
                </x-jet-secondary-button>

                @if ($this->user->profile_photo_path)
                    <x-jet-secondary-button type="button" class="mt-2" wire:click="deleteProfilePhoto">
                        {{ __('Remove Photo') }}
                    </x-jet-secondary-button>
                @endif

                <x-jet-input-error for="photo" class="mt-2" />
            </div>
        @endif
tvz2xvvm

tvz2xvvm1#

您可能还没有激活jetstream配置中的profilePhotos部分。
转到config/jetstream.php并找到features部分。你可能会看到Features::profilePhotos()被注解了。

相关问题