public function createOrUpdate($entityId, $entityType, $lang, $payload)
    {
        $translation = $this->model->firstOrCreate([
            'entity_id' => $entityId,
            'entity_type' => $entityType,
            'language' => $lang,
        ]);

        unset($payload['_method']);
        unset($payload['_token']);

        $translation->entity_data = json_encode($payload);

        return $translation->save();
    }
public function createOrUpdate($entityId, $entityType, $lang, $payload)
    {
        $translation = $this->model->firstOrCreate([
            'entity_id' => $entityId,
            'entity_type' => $entityType,
            'language' => $lang,
        ]);

        unset($payload['_method']);
        unset($payload['_token']);

        $translation->entity_data = json_encode($payload);

        return $translation->save();
    }
public function createOrUpdate ( $ entityId , $ entityType , $ lang , $ payload ) { $ translation = $ this -> model -> firstOrCreate ( [ 'entity_id' => $ entityId , 'entity_type' => $ entityType , 'language' => $ lang , ] ) ; unset ( $ payload [ '_method' ] ) ; unset ( $ payload [ '_token' ] ) ; $ translation -> entity_data = json_encode ( $ payload ) ; return $ translation -> save ( ) ; }
Create or Update an entry

@param  integer $entityId
@param  string $entityType
@param  string $lang
@param  array $payload

@return boolean
Create or Update an entry