php - Laravel and SQL server and database class -


i have got laravel installed , trying fetch data sql server database keep having same problem time , getting frustrated because either don't know doing or doing wrong.

i've got database connection set after lot of hassle odbc sql drivers windows. in welcome.blade.php want fetch data database everytime try data error:

fatal error: class 'illuminate\support\facades\db' not found in c:\xampp\htdocs\resources\views\welcome.blade.php on line 9

now got these 2 lines in code should fetch (i guess) data:

<?php     $booking = \illuminate\support\facades\db::table('fmsstage.dbo.booking')->get();     var_dump($booking); ?> 

but instead gives me error. , i've tried using \db::table , tried using table \db::table('booking') , table prefix \db::table('dbo.booking') won't find whole db class. doing wrong, don't @ all.

when try add

use db;

it gives me error/warning:

warning: use statement non-compound name 'db' has no effect in c:\xampp\htdocs\resources\views\welcome.blade.php on line 9

update: have created model booking data booking. when use

use app\booking; $booking = app\booking::all(); foreach($booking $bookings) {     echo $bookings->agent; } 

it stills gives me error on freaking use part...

fatal error: class 'app\booking' not found in c:\xampp\htdocs\resources\views\welcome.blade.php on line 10

thank in advance

try this:

use \illuminate\support\facades\db; $data = db::table("tablename")->get(); dd($data); 

ofcourse in controller,not views~


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -