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

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Apache Thrift Tutorial Error -