I am trying to check what will be the result of MySQL query inside Laravel FW. I develop a file for this:
<?php
namespace AppHttpControllers;
use AppHttpControllersController;
use IlluminateSupportFacadesDB;
use IllumunateHttpRequest;
function DBTest(){
echo "test1 n";
$DBTickers [] = DB::table('stocks')->select('id')->get();
echo "test2 n";
echo $DBTickers;
}
?>
my problem is that I can’t call DBTest from CLI. I try:
php -f ./dbTest.php DBTest -> nothing prints
php –run “require ‘./dbTest.php’; DBTest();” ->
PHP Fatal error: Call to undefined function DBTest() in Command line code on line 1
php -r ‘include (“./dbTest.php”); DBTest();’
PHP Fatal error: Call to undefined function DBTest() in Command line code on line 1
If I comment the “namespace” and “use” directives and I can call DBTest().
So, My question is is there a way (syntax) that can call the DBTest function from CLI while the “namespace” and “use” are presented?