Jump to content

Laravel :: Foreach - Dificuldade em mostrar os resultados


klasss
Go to solution Solved by bioshock,

Recommended Posts

Olá a todos, 
Estou com uma pequena dificuldade em mostrar os dados no meu index. 
index.blade.php

 <table id="example1" class="table table-bordered table-striped">
                  <thead>
                  <tr>
                    <th>Fotografia</th>
                    <th>Nome</th>
                    <th>Email</th>
                    <th>Função</th>
                    <th>Data Entrada</th>
                  </tr>
                  </thead>
                  
                  <tbody>
                  @foreach($funcionarios as $funcionario)
                  <tr>
                    <td>{{$funcionario->id}}</td>

                  </tr>
                    @endforeach

                  </tbody>
                  <tfoot>
                  <tr>
                    <th>Fotografia</th>
                    <th>Nome</th>
                    <th>Email</th>
                    <th>Função</th>
                    <th>Data Entrada</th>
                  </tr>
                  </tfoot>
                </table>

 

FuncionarioController. 
 

    public function index(){
        $tabela = funcionario::orderby('id', 'desc');
        return view('painel-admin.utilizadores.index', ['funcionarios' => $tabela]);

    }

 

Mostra a estrutura da tabela mas os dados não aparecem. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.