【发布时间】:2022-01-27 18:55:59
【问题描述】:
我正在尝试为我的页面创建一个默认头像,但只出现一个字符串,而不是我的图像。这是我的工作:
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('avatar')->default('/storage/avatars/avatar.png');
$table->rememberToken();
$table->timestamps();
});
}
in Migrations
-------------------
<img src="{{ $page.props.auth.user.avatar }}" alt=""> {{ $page.props.auth.user.avatar }}
In my code
obs: this second {{ $page.props.auth.user.avatar }} is only for show what is coming
【问题讨论】:
-
$page.props.auth.user.avatar不是有效的 PHP 代码。 -
我在 Vue 中使用 Laravel Breeze,我的用户名显示为 $page.props.auth.user.name
-
好吧,不熟悉。