laravellaravel-bladelaravel-8laravel-datatables

How can I make a beautiful table view on a website page ? Laravel


Need help with the design of the text on the site page,I display the data of the table and they do not look good (attached a screenshot) help my view file:

@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(


Solution

  • So, laravel has bootstrap from the box, so you can use it. This is the easiest way to get a good table

    You can get tabel html from this page and then put your data in it

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

    Samthing like this

    <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>