Ich konvertiere ein Projekt von reinem PHP nach Laravel 5.1, und ich habe ein Problem mit der Umwandlung dieser Abfrage:
DB::select( "SELECT TABLE_NAME as nombre, FORMAT(TABLE_ROWS, 0) as cantidad
FROM information_schema.tables
WHERE table_type = "BASE TABLE" AND table_schema = "".env("DB_DATABASE")."" " );
zu beredten ORM. Kannst du mir helfen?
Antworten:
0 für die Antwort № 1Dies ist eine andere Art zu schreiben
DB::table("tables")
->where("table_type", "BASE TABLE")
->where("table_schema", env("DB_DATABASE"))
->select(
"TABLE_NAME as nombre",
DB::raw("FORMAT(TABLE_ROWS, 0) as cantidad")
)
->get();