kreait / laravel-firebase

A Laravel package for the Firebase PHP Admin SDK
https://github.com/kreait/firebase-php
MIT License
994 stars 163 forks source link

Call to undefined function App\Http\Controllers\getValue() #176

Closed akubima closed 1 year ago

akubima commented 1 year ago

Describe the bug

Call to undefined function App\Http\Controllers\getValue()

public static function GetTelemetry($device_id){ return Firebase::database()->getReference('/'.$device_id.'/telemetries').getValue(); }

Installed packages

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.1",
        "guzzlehttp/guzzle": "^7.2",
        "kreait/laravel-firebase": "^5.2",
        "laravel/framework": "^10.0",
        "laravel/sanctum": "^3.2",
        "laravel/tinker": "^2.8"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.18",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^7.0",
        "phpunit/phpunit": "^10.0",
        "spatie/laravel-ignition": "^2.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true,
            "php-http/discovery": true
        }
    },
    "minimum-stability": "stable",
    "prefer-stable": true
}

PHP version and extensions

composer               2.2.6    Composer package
composer-plugin-api    2.2.0    The Composer Plugin API
composer-runtime-api   2.2.2    The Composer Runtime API
ext-calendar           8.1.2    The calendar PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-ctype              8.1.2    The ctype PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-curl               8.1.2    The curl PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-date               8.1.2    The date PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-dom                20031129 The dom PHP extension
ext-exif               8.1.2    The exif PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-ffi                8.1.2    The FFI PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-fileinfo           8.1.2    The fileinfo PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-filter             8.1.2    The filter PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-ftp                8.1.2    The ftp PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-gettext            8.1.2    The gettext PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-hash               8.1.2    The hash PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-iconv              8.1.2    The iconv PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-intl               8.1.2    The intl PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-json               8.1.2    The json PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-libxml             8.1.2    The libxml PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-mbstring           8.1.2    The mbstring PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-mysqli             8.1.2    The mysqli PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-mysqlnd            0        The mysqlnd PHP extension (actual version: mysqlnd 8.1.2-1ubuntu2.11)
ext-openssl            8.1.2    The openssl PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-pcntl              8.1.2    The pcntl PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-pcre               8.1.2    The pcre PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-pdo                8.1.2    The PDO PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-pdo_mysql          8.1.2    The pdo_mysql PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-phar               8.1.2    The Phar PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-posix              8.1.2    The posix PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-readline           8.1.2    The readline PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-reflection         8.1.2    The Reflection PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-session            8.1.2    The session PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-shmop              8.1.2    The shmop PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-simplexml          8.1.2    The SimpleXML PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-sockets            8.1.2    The sockets PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-sodium             8.1.2    The sodium PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-spl                8.1.2    The SPL PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-sysvmsg            8.1.2    The sysvmsg PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-sysvsem            8.1.2    The sysvsem PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-sysvshm            8.1.2    The sysvshm PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-tokenizer          8.1.2    The tokenizer PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-xml                8.1.2    The xml PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-xmlreader          8.1.2    The xmlreader PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-xmlwriter          8.1.2    The xmlwriter PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-xsl                8.1.2    The xsl PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-zend-opcache       8.1.2    The Zend OPcache PHP extension (actual version: 8.1.2-1ubuntu2.11)
ext-zlib               8.1.2    The zlib PHP extension (actual version: 8.1.2-1ubuntu2.11)
lib-curl               7.81.0   The curl library
lib-curl-libssh        0.9.6    curl libssh version
lib-curl-openssl       3.0.2.0  curl OpenSSL version (3.0.2.0)
lib-curl-zlib          1.2.11   curl zlib version
lib-date-timelib       2021.11  date timelib version
lib-date-zoneinfo      0        zoneinfo ("Olson") database for date
lib-fileinfo-libmagic  540      fileinfo libmagic version
lib-iconv              2.35     The iconv library
lib-icu                70.1     The ICU unicode and globalization support library
lib-icu-cldr           40       ICU CLDR project version
lib-icu-unicode        14.0.0   ICU unicode version
lib-libsodium          1.0.18   The libsodium library
lib-libxml             2.9.13   libxml library version
lib-libxslt            1.1.34   The libxslt library
lib-libxslt-libxml     2.9.13   libxml version libxslt is compiled against
lib-mbstring-libmbfl   1.3.2    mbstring libmbfl version
lib-mbstring-oniguruma 6.9.7    mbstring oniguruma version
lib-openssl            3.0.2.0  OpenSSL 3.0.2 15 Mar 2022
lib-pcre               10.39    The pcre library
lib-pcre-unicode       14.0.0   PCRE Unicode version support
lib-zlib               1.2.11   The zlib library
php                    8.1.2    The PHP interpreter
php-64bit              8.1.2    The PHP interpreter, 64bit
php-ipv6               8.1.2    The PHP interpreter, with IPv6 support

Steps to reproduce the issue.

# Insert the commands issued in the terminal if they are needed
# to reproduce the issue. Otherwise, delete this code block.
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Kreait\Laravel\Firebase\Facades\Firebase;
use Kreait\Laravel\Firebase\Database;

class FirebaseController extends Controller
{
    public function __construct(){
        if (!Auth::check()) {
            return redirect(route('login'));
        }
    }
    public static function GetTelemetry($device_id){
        return Firebase::database()->getReference('/'.$device_id.'/telemetries').getValue();
    }
}

Error message/Stack trace

Call to undefined function App\Http\Controllers\getValue()

Additional information

No response

jeromegamez commented 1 year ago

Replace .getValue(); With ->getValue();

In PHP, dots are used for concatenation.

akubima commented 1 year ago

Thank you so much, you can laugh at me, I didn't even realize that I shouldn't have used "." lol 😆 . Sorry for taking up your time.