I have custom class in laravel 5.4 app which should return hashed secret. The class is 

```
class Hash {

   // Unencrypted secret

   private $secret;

   public function generateSecret(){

       $secret = generateSecretKey();

       $secret_hash = password_hash($secret, PASSWORD_BCRYPT);

       Session::put('secret-hash', $secret_hash);
       $this->secret = $secret;        
   }
}

```

Then in my controller I have

```
use Hash;
class UsersController extends BaseController
{
    public function Auth()
    {
        $myhash = new Hash();
        $msg = '';

        $myhash->generateSecret();
        $enc = $myhash->encryptSecret($key->key);
        return View::make('users.auth', ['enc'=> $enc]);
    }
     ...
}

```

`var_dump($myhash->generateSecret());` from the controller return `NULL`

`var_dump($secret)` in `public function generateSecret()` return `string(15) "866094233422231" string(15) "583375207466239"` which is correct. 

`var_dump($myhash);` in UsersController also return correct data

```
String(15) "008844975703088" object(Hash)#329 (1) 
{ 
     ["secret":"Hash":private]=> string(15) "008844975703088" 
}

```

Appears that the problem is in controller and generating the hash `$myhash->generateSecret();`. The function must generate secret(a string) which then is hashed `$enc = $myhash->encryptSecret($key->key);` and displayed on page.

Any ideas why the function isn't working? I don't know what else I can try.