Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
213 views
in Technique[技术] by (71.8m points)

php - Blade doesn't display my data in HTML - LARAVEL

Hi I have small problem with displaying data from DATABASE, my code work but in view-source code isnt data from DB

Blade

    <form action="{{ url('turnaje/choose')}}" method="post">
        @csrf <!-- {{ csrf_field() }} -->
        <label for="cars">Kraj:</label>

        <select name="region_id" onchange="this.form.submit()">
    <option value="vsetky-kraje">V?etky kraje</option>
  @foreach ($regions_list as $region_list)
            <option value="{{ $region_list->slug }}" {{ ($region_list->slug == $region->slug) ? 'selected' : '' }}>{{ $region_list->title }}</option>
        @endforeach
    </select>
    </form>
        <div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
            <main>
                <section class="container mx-auto flex items-center flex-wrap pt-4 pb-12">
                    @foreach ($tournaments as $tournament)
                    <h1>{{ $tournament->title }}</h1>
                    @endforeach
                    <div class="w-full md:w-1/3 xl:w-1/4 p-6 flex flex-col">
                    </div>
                </section>
            </main>
        </div>

Controller, i take regions table, tournament table from database and after send to blade.

public function show($slug)
{
    $region = Region::where('slug', $slug)->firstOrFail();
    return view('tournaments.show', [
        'regions_list' => Region::all(),
        'tournaments' => Tournament::where("region_id", "=", $region->id),
        'region' => $region,
    ]);
}

view-source code - here isnt my title from database

                <option value="bratislavsky-kraj" selected>Bratislavsky</option>
                        <option value="trnavsky-kraj" >Trnavsky</option>
                        <option value="trenciansky-kraj" >Tren?iansky</option>
                        <option value="nitriansky-kraj" >Nitriansky</option>
                        <option value="zilinsky-kraj" >?ilinsky</option>
                        <option value="banskobystricky-kraj" >Banskobystricky</option>
                        <option value="presovsky-kraj" >Pre?ovsky</option>
                        <option value="kosicky-kraj" >Ko?icky</option>
                </select>
    </form>
        <div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
            <main>
                <section class="container mx-auto flex items-center flex-wrap pt-4 pb-12">
                                            <div class="w-full md:w-1/3 xl:w-1/4 p-6 flex flex-col">
                    </div>
            
question from:https://stackoverflow.com/questions/65942941/blade-doesnt-display-my-data-in-html-laravel

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...