php - Laravel Handling Undefined offset: 0 -
in view in input value field using {{ old('facebook', $sitesocialdata->facebook)}}
, in controller have below code.
is there way can hide offset db error if there no data in db? db empty.
controller:
$sitesocialsettingsdb = socialsettings::get(); $sitesocialsettingsdata = $sitesocialsettingsdb[0];
if write:
$sitesocialsettingsdb::first();
it returns instance of model if exists, , null if doesn't.
Comments
Post a Comment