Support the ongoing development of Laravel.io →
posted 8 years ago
Eloquent
Last updated 1 year ago.
0

If you want to call users table from database , you must to send the array from the controller ,and into the view you can call it. I think you can send many arrays or variable from the controller . I used the same model what Lavarel has by default.


<?php namespace App\Http\Controllers;

use App\User;

class Menu extends Controller {


	public function prueba()
	{
		$users = User::get();
		return view('prueba',compact('users'));
	}
?>
                        <table  >
                            <tr>
                                <th>ID</th>
                                <th>nombre</th>
                                <th>email</th>
                                <th>actions</th>
                            </tr>
							
                            @foreach($users as $user)
                                <tr>
                                    <td>{!! $user->id !!}</td>
                                    <td>{!! $user->name !!}</td>
                                    <td>{!! $user->email !!}</td>
                                    <td>
                                        <a href="">Edit</a>
                                        <a href="">Delete</a>
                                    </td>
                                </tr>
                            @endforeach
				
                        </table>
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.