I'm trying to echo first_name on the page but I couldn't work it out how.
$providerEmail = Auth::user()->email;
$providerName = Auth::user()->first_name;
return View::make('account')->with( 'providerEmail', $providerEmail, 'providerName', $providerName);
the ()->email bit works, it echos the user email but when echoing first_name it gives me $providerName error (Undefined variable: providerName).
You could clean this up considerably. Rather than assigning a new view variable for each property of your provider, just send the entire provider model to your view like this.
<?php
$provider = Auth::user();
return View::make('account')->with('provider', $provider);
Then in your views, you can access the email, name, and other properties just as you would in your route or controller.
In View
$provider->email
You need one more ->with()
:
$providerEmail = Auth::user()->email;
$providerName = Auth::user()->first_name;
return View::make('account')->with('providerEmail', $providerEmail)
->with('providerName', $providerName);