Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Ich kann in Laravel 5 nicht auf die rohe PDO-Instanz zugreifen

   <?php
    
    namespace App\Http\Controllers\your_controller_path;
    
    use DB;// important
//then in
class your_controller extends Controller{
public function index(Request $request ){
    $pdo = DB::connection()->getPdo();
    $query=$pdo->prepare("SHOW TABLES");
    $query->execute();//$query->execute(array($bindings ));
    while($row=$query->fetch(\PDO::FETCH_BOTH)) {
        //Use \PDO::FETCH_ASSOC, \PDO::FETCH_OBJ    
        //echo $row->yourcolumnname;//its an object when \PDO::FETCH_OBJ
        echo $row[0]; //Indexed Array
                                    
    }
}