Reputation: 493
My routes:
Route::group(array("namespace" => "languages"),function(){
Route::resource("languagesService", "languageServiceController");
Route::resource("languages","languageController");
});
languageservicecontroller and languagecontroller are in subfolder languages.
During login attempt i saved username and password in
Session::put('username', $user['username']);
Session::put('password', $user['password']);
But when i try to retrieve from languageController
$username = Session::get('username');
$password = Session::get('password');
i am getting following error
"Class 'languages\Session' not found" .
Upvotes: 3
Views: 1083
Reputation: 191
IF your using Sentry to handle the User sessions it should be
$user = Sentry::getUser();
if ( isset($user) )
{ $username = Helpers::loggedInUser()->username;
Upvotes: 0
Reputation: 12169
You are trying to access the Session
class from a namespace where the Session
class does not exist.
Try the following:
\Session::get('password')
OR
Include Session
class at the top of your file.
<?php namespace languages;
use Session;
class languageServiceController
{
}
Upvotes: 5