php - Fetching and printing a single value from database using laravel -


i'm trying create settings page creating table settings company_name column. idea fetch single value company_name , print in title of pages , name going appearing. not sure how convert array return db::select able print correctly.

the code:

public function __construct() {      $company_name = db::table('settings')->select('company_name')->get();      return view::share('company_name', $company_name); } 

and print in blade system {{ $company_name }}, although can't convert array string.

either use eloquent (that recommend) :

$company_name = setting::first()->company_name; 

or using fluent :

$company_name = db::table('settings')->company_name; 

Comments

Popular posts from this blog

javascript - How to name a jQuery function to make a browser's back button work? -

python - Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installed -

collision detection - C++ library for mesh to mesh intersection: what is available? -