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

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -