Greetings guys can you point to me what is the problem here?
This is the code that produces the error. That is in my views:
<h7 id="header-label">Welcome, {{ $fname }} |</h7>
This is the controller:
class ProfileController extends BaseController {
public function showProfile() {
$items = DB::table('item_tbl')->get();
// Auth::check();
// if (Auth::check())
// {
// return "true";
// } else {
// return "false";
// }
//$fname = Auth::user()->[firstname];
// var_dump(Session::get('fname'));
return View::make('profile')->with('items', $items);
}
}
and this is the model:
if (Auth::attempt(array('username' => $data['username'], 'password' => $data['password'])))
{
$fname = Auth::user()->firstname;
return Redirect::to('profile');
//return View::make('profile')->with('name', $fname);
//return Redirect::to('profile')->with('name', $fname);
// $fname =;
} else {
return Redirect::back()
->with('message', 'Invalid username/password');
}
This is my route:
Route::get('profile', 'ProfileController@showProfile');
I break those codes down. I found out that; when i use the Session::get('fname') it returns null.
Names of the Controller and Views
Controller - ProfileController
Views - profile.blade.php