Skip to content

Commit

Permalink
save contact info using localized content
Browse files Browse the repository at this point in the history
  • Loading branch information
nivv committed Oct 4, 2021
1 parent c822380 commit 350bad0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ public function up()
'sort_index' => 20
]);

$templateField = RevisionTemplateField::factory()->create([
'template_id' => $template->id,
'name' => 'Roll',
'key' => 'position',
'type' => 'text',
'translated' => true,
'group' => 'contact',
'repeater' => false,
'sort_index' => 30
]);

Schema::table('contacts', function (Blueprint $table) {
$table->dropColumn('body');
});
Expand Down
1 change: 0 additions & 1 deletion src/Http/Controllers/Api/Fabriq/ContactsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public function update(UpdateContactRequest $request, int $id) : JsonResponse

$contact->contactTags = $request->tags;
$contact->localizedContent = $request->localizedContent;
$contact->updateContent($request->content, $request->input('locale', app()->getLocale()));
$contact->save();

return $this->respondWithItem($contact, new ContactTransformer);
Expand Down
4 changes: 1 addition & 3 deletions tests/ContactsFeatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ public function it_can_update_a_contact()
'published' => true,
'locale' => 'sv',
'content' => [
// 'image' => [
// 'id' => 1
// ]
'body' => '<p>a nice text</p>'
],
'localizedContent' => [
'sv' => [
Expand Down

0 comments on commit 350bad0

Please sign in to comment.