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

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

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