国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

How to display value from controller to Blade file in php laravel?
P粉842215006
P粉842215006 2023-12-12 23:52:18
0
1
606

From controller:

$response = (new ApiController)->checkNumbers();
    if(!empty($response['status']) && ($response['status'] == 'SUCCESS')) {
                $numbers = json_encode($response['numbers']);
    }
    return [
              'html' => view('show.numbers', compact(
                        'numbers'
                    ))->render()
                ];

How to display "numbers" in the blade file to reflect the UI in the table? Any help would be greatly appreciated.

Thank you so much

P粉842215006
P粉842215006

reply all(1)
P粉138871485

The following example shows how to pass data from the controller and populate it to the blade.

For example, I have a table: 'user', which contains id, first name and last name columns:

SampleController.php

public function FetchUser(){
    $data = User::all();
    
    return view('MyView')->with([
     'data' => $data
    ]);
}

MyView.blade.php

{{-- populate it in a table --}}
@foreach($data as $item){ }
ID First Last
{{$item->id}} {{$item->firstname}} {{$item->lastname}}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template