如何在网站页面上制作漂亮的表格视图? Laravel

问题描述

需要帮助设计网站页面上的文字,我显示表格的数据,它们看起来不太好(附截图)帮助 我的视图文件:

@extends('layouts.layout')
@section('title')Бізнес@endsection
@section ('main_content')
    <h1>Бизнес</h1>
    <p>
    @foreach ($business as $singleBusiness)
        <li>{{ $singleBusiness->id}}</li>>
        <li>{{ $singleBusiness->name}}</li>>
        <li>{{ $singleBusiness->mail}}</li>>
        <li>{{ $singleBusiness->website}}</li>>
        @endforeach
        </p>
@endsection

my plate looks like this,all records are vertical(

解决方法

所以,laravel 有自举程序,所以你可以使用它。这是获得好桌子的最简单方法

您可以从该页面获取 tabel html,然后将您的数据放入其中

https://getbootstrap.com/docs/4.5/content/tables/

就像这样

<table class="table">
    <thead>
      <tr>
        <th scope="col">#</th>
        <th scope="col">name</th>
        <th scope="col">mail</th>
        <th scope="col">website</th>
      </tr>
    </thead>
    <tbody>
        @foreach ($business as $singleBusiness)
        <tr>
            <th scope="row">{{ $singleBusiness->id}}</th>
            <td>{{ $singleBusiness->name}}</td>
            <td>{{ $singleBusiness->mail}}</td>
            <td>{{ $singleBusiness->website}}</td>
      </tr>
      @endforeach
    </tbody>
</table>

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...