小编10k*_*deo的帖子

找不到类“App\Http\Controllers\User”

所以我从我的数据库中获取数据以打印在表格中,但是它说

找不到类“App\Http\Controllers\User”。

这是控制器,这是我将如何打印数据

public function directory()
    {
        $dashboardTitle = "Directory";
    $isCurrent = "Directory";
    $users = User::all();
    return view('dashboard.directory', [
        'dashboardTitle' => $dashboardTitle,
        'isCurrent' => $isCurrent,
        'users' => $users
    ]);
    }
Run Code Online (Sandbox Code Playgroud)

要打印的表

  <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                                    <thead>
                                        <tr>
                                        <th> Picture </th>
                                            <th>Name</th>
                                            <th>Email</th>
                                            <th>User type</th>
                                            <th>Birthdate</th>
                                            <th>Contact number</th>
                                            <th>Created time</th>
                                        </tr>
                                        @foreach($users as $user)
                                        <tr>
                                           <td>{{ $user->profile_image }}</td>
                                            <td>{{ $user->name }}</td>
                                            <td>{{ $user->email }}</td>
                                            <td>{{ $user->user_type }}</td>
                                            <td>{{ $user->bdate }}</td>
                                            <td>{{ $user->contact_no}}</td>
                                            <td>{{ $user->created_at }}</td>
                                        </tr>
                                        @endforeach
                                    </thead>
                                    <tfoot> …
Run Code Online (Sandbox Code Playgroud)

php mysql database laravel laravel-8

0
推荐指数
1
解决办法
34
查看次数

标签 统计

database ×1

laravel ×1

laravel-8 ×1

mysql ×1

php ×1