public function publicKey(User $user, $reset = false)
    {
        $model = ApiPublicPrivate::query()->firstOrNew(['user_id' => $user->id]);
        if (!$model->exists or $reset) {
            $model->public_key = hash('sha256', openssl_random_pseudo_bytes(32));
            $model->save();
        }
        return $model->public_key;
    }
public function publicKey(User $user, $reset = false)
    {
        $model = ApiPublicPrivate::query()->firstOrNew(['user_id' => $user->id]);
        if (!$model->exists or $reset) {
            $model->public_key = hash('sha256', openssl_random_pseudo_bytes(32));
            $model->save();
        }
        return $model->public_key;
    }
public function publicKey ( User $ user , $ reset = false ) { $ model = ApiPublicPrivate :: query ( ) -> firstOrNew ( [ 'user_id' => $ user -> id ] ) ; if ( ! $ model -> exists or $ reset ) { $ model -> public_key = hash ( 'sha256' , openssl_random_pseudo_bytes ( 32 ) ) ; $ model -> save ( ) ; } return $ model -> public_key ; }
User private key getter

@param User $user
@param boolean $reset
@return String
User private key getter