在Laravel中显示“艺术家”表中的数据时出现问题

我无法显示数据库中的数据(我正在使用Laragon)。


我已经试图在这里和那里更改一些名称(变量等),但是我找不到问题的根源。


我首先无法显示任何内容,因此需要进行以下更改:


resources \ views \ artist \ index.php-> resources \ views \ artist的\ index。刀片.php


我可能需要更改代码中的更多内容,但我不知道在哪里。


查看(views \ artists \ index.blade.php)


@extends('layouts.app')


@section('title', 'Liste des artistes')


@section('content')

    <h1>Liste des {{ $resource }}</h1>


    <table>

        <thead>

        <tr>

            <th>Firstname</th>

            <th>Lastname</th>

        </tr>

        </thead>

        <tbody>

        @foreach($artists as $artist)

            <tr>

                <td>{{ $artist->firstname }}</td>

                <td>{{ $artist->lastname }}</td>

            </tr>

        @endforeach

        </tbody>

    </table>

@endsection

路线(routes \ web.php)


<?php


Route::get('/', function () {

    return view('welcome');

});


Route::get('artists', 'ArtistController@index');

控制器(Controllers \ ArtistController.php)

当我进入浏览器时,唯一显示在我的浏览器上的127.0.0.1:8000/artists是:

**Liste des Artistes** 
Firstname Lastname

但是,从我的艺术家表的内容中没有显示任何内容。


料青山看我应如是
浏览 115回答 1
1回答

MYYA

问题在于我需要更改列的名称...从“姓氏”到“姓氏”数据现在可以正确显示。
打开App,查看更多内容
随时随地看视频慕课网APP