按照教程做到 6.2 显示用户信息,为什么输入 URL 后报这样的错误?

错误截图,URL见红箭头处

按照教程做到6.2显示用户信息,为什么输入URL后报这样的错误?
user控制器代码:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\User;

class UsersController extends Controller
{
    public function create()
    {
        return view('users.create');
    }

    public function show(User $user)
    {
        return view('users.show', compact('user'));
    }
}

user模型代码

<?php

namespace App\Models;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;
    protected $table = 'users';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];
}

路由代码

<?php
Route::get('/', 'StaticPagesController@home')->name('home');
Route::get('/help', 'StaticPagesController@help')->name('help');
Route::get('/about', 'StaticPagesController@about')->name('about');

Route::get('signup', 'UsersController@create')->name('signup');
Route::resource('users', 'UsersController');

请大佬指教!

《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
最佳答案

你有show这个模板文件吗?

4年前 评论
xingkong12138 (作者) 4年前
讨论数量: 4

看下报错日志,或者 php 调试开启下看看

4年前 评论

/storage/logs/laravel.log 答案就在这里

4年前 评论

你有show这个模板文件吗?

4年前 评论
xingkong12138 (作者) 4年前
liwei3773

@likunyan 是没有show这个模板的原因,但是为什么不报具体错误,而只报个500错误呢?我debug打开了呀?

file

4年前 评论
xingkong12138 4年前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!