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
Post a Comment