Link to home
Start Free TrialLog in
Avatar of zack tim
zack timFlag for Morocco

asked on

How to access property from model and display it in view

Hello Experts


I need to access the mode payment to display "Cash" for example in index.blade.php instead of "by_cash" in vouchersAccountings blade


My model:

public const PAYMENT_MODE_SELECT = [
        'by_cash'   => 'Cash',
        'by_cc'     => 'Credit Card',
        'by_chechk' => 'Check',
        'by_wire'   => 'Wire Transfer',
    ];

Open in new window



  @foreach($Reports as $Report)
                                        <tr>
                                            <th> {{$Report->id}} </th>
                                            <th> {{$Report->client_name}} </th>
                                            <th> {{$Report->hotel_name->hotel_name}} </th>
                                            <th> {{$Report->arrivaldate}} </th>
                                            <th> {{$Report->departuredate}} </th>
                                            <th> {{$Report->night}} </th>
                                            <th> {{$Report->number_of_room}}</th>
                                            <th> {{$Report->payment_mode}}</th>
                                            <th> {{$Report->total_amount}}</th>

Open in new window


ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial