public function update($widget, $payload)
    {
        $payload['name'] = htmlentities($payload['name']);

        if (!empty($payload['lang']) && $payload['lang'] !== config('cms.default-language', 'en')) {
            return $this->translationRepo->createOrUpdate($widget->id, 'Grafite\Cms\Models\Widget', $payload['lang'], $payload);
        } else {
            unset($payload['lang']);

            return $widget->update($payload);
        }
    }
public function update($widget, $payload)
    {
        $payload['name'] = htmlentities($payload['name']);

        if (!empty($payload['lang']) && $payload['lang'] !== config('cms.default-language', 'en')) {
            return $this->translationRepo->createOrUpdate($widget->id, 'Grafite\Cms\Models\Widget', $payload['lang'], $payload);
        } else {
            unset($payload['lang']);

            return $widget->update($payload);
        }
    }
public function update ( $ widget , $ payload ) { $ payload [ 'name' ] = htmlentities ( $ payload [ 'name' ] ) ; if ( ! empty ( $ payload [ 'lang' ] ) && $ payload [ 'lang' ] !== config ( 'cms.default-language' , 'en' ) ) { return $ this -> translationRepo -> createOrUpdate ( $ widget -> id , 'Grafite\Cms\Models\Widget' , $ payload [ 'lang' ] , $ payload ) ; } else { unset ( $ payload [ 'lang' ] ) ; return $ widget -> update ( $ payload ) ; } }
Updates Widget in the database

@param Widgets $widget
@param array $payload

@return Widgets
Updates Widget in the database