Displaying authenticated user data in view

4

I have a problem that I think is very simple ... I need to show the username logged in my views ... How do I do this?

this is one of the views

@extends('layouts.template')

@section('body')

<h3>List_Lists</h3>
<p>
    <a href="{{ URL::to('list/create') }}">Adicionar Lista</a> <br />
</p>

<ul style="list-style:none;">
    @foreach($lists as $lista)
        <li class="task">
            <a href="{{ URL::to('list') }}/{{ $lista->id }}">{{ $lista->titulo }}
            ({{ count( $lista->tasks ) }} Tasks)</a> <br />
        </li>
    @endforeach
</ul>
@stop   
    
asked by anonymous 18.12.2013 / 22:09

2 answers

8
{{ Auth::user()->nome }}

Or in the place of the property name, which you need to use.

    
19.12.2013 / 01:59
4

In your View you will already have:

{{ Auth::user()->nome }}

to display the name of the logged-in user.

You can pass multiple variables to your view:

$produtos  = Produtos::all();
$novidades = Novidades::all();
View::make('index', compact("novidades","produtos") )
    
19.12.2013 / 13:01