I want use class DB in code, my code this file klasa.php in directory helpers (Ja zamierzam użyć klasy DB w kodzie mój kod to plik klasa.php w katalogu helpers) File klasa.php
<?php
//namespace App\Helpers;
//use ...\Form;
namespace App\Http\Controllers;
use DB;
use App\Quotation;
class SomeClass
{
public static function SomeMethod()
{
print "<font color=red>Dobrze</font>";
}
public static function dodaj_staty($ip,$http_user_agent,$co_robil) {
//$system = $this->system_operacyjny($http_user_agent);
//$przegla = $this->przegladarka($http_user_agent);
$system = "tomi";
$przegla = "tomek";
$sql = 'INSERT INTO statystyki (aa, bb, cc,fff,gg,iii)
VALUES (?, ?, ?,?,?,?)';
$data = time();
$data1 = array($data, $system ,$przegla,$http_user_agent,$co_robil,$ip);
//on this line return error PHP Fatal error: Class 'App\\Helpers\\SomeClass' not found
\DB::insert($sql, $data1);
}
this function call in file (tą funkcje wywołuje plik)
$a = new \App\Helpers\SomeClass();
$a->dodaj_staty('d','dd','g');
you see use these instructions (wy widzicie użyłem takich instrukcji)
namespace App\Http\Controllers;
use DB;
use App\Quotation;
on this application itself is used logon and this use mysql and it works good, maybe because that not use instructions DB::select. I changed instructions DB::insert at $ff = DB::select and not it was any errors, but how printers variable $ff then see error.