I cant seem to get my code working 100%. I am trying to get my code to work in a way like this:
if the column value is empty ($id = columnName
) then insert into that row. If there is a "value" found for that $id
then update the value already saved in the DB.
Function:
$socialCheck = SocialSettings::where($id)->first();
$socialInsert = new SocialSettings;
$value = Request::input('value');
if(SocialSettings::where_not_null($id)){
$socialInsert->$id = $value;
$socialInsert->save();
}else{
$socialCheck->update($value);
}
}