2014-02-13 46 views
0

我無法將Sentry用戶的電子郵件傳遞給我的數據庫。我可以成功傳遞用戶的ID,但不能傳遞電子郵件。Laravel Sentry getUser->電子郵件

public static function loggedInUser() 
{ 
    $user = Sentry::getUser(); 

    if (isset($user)) 
    { 
     return $user; 
    } 
} 

public static function loggedInUserEmail() 
{ 
    $user = Sentry::getUser(); 
      $email = $user->email; 

    if (isset($email)) 
    { 
     return $email; 
    } 
} 

public function store() 
{ 
      $id = Helpers::loggedInUser()->id; // this works 
      $email = Helpers::loggedInUserEmail()->email(); //i have tried also 
      $email = Helpers::loggedInUserEmail()->email; //i have tried also 
      $email = Helpers::loggedInUser()->email; //i have tried also 
      $email = Helpers::loggedInUser()->email(); //i have tried also 
      $input['email'] = $email;  
      $input['creator_id'] = $id; 
    $this->actor->create($input); 
} 

回答

0

我不知道有關哨兵,但在這種情況下,我認爲你應該嘗試打印對象和它的方法。你一定會有一些想法接下來做。

Regards