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

Recommended Answers

All 6 Replies

And also it always return false when i use

Auth::check()

yeah cause i posted it on the wrong forum but it's not actually solved.

For the future, please flag the article, someone will move it for you. Cereal posted a potential answer for you in the other thread.

Multiple threads may/can be confusing for members and also cause disjointed discussions.

Sorry for that XD. But can i request to delete this post XD?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.