Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
37a09c42
Unverified
Commit
37a09c42
authored
Sep 17, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle fields manually in order to have empty translations too
parent
77fb6169
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
FullPageTransformer.php
Modules/Page/Transformers/FullPageTransformer.php
+6
-2
No files found.
Modules/Page/Transformers/FullPageTransformer.php
View file @
37a09c42
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
Modules\Page\Transformers
;
namespace
Modules\Page\Transformers
;
use
Illuminate\Http\Resources\Json\Resource
;
use
Illuminate\Http\Resources\Json\Resource
;
use
Mcamara\LaravelLocalization\Facades\LaravelLocalization
;
class
FullPageTransformer
extends
Resource
class
FullPageTransformer
extends
Resource
{
{
...
@@ -14,9 +15,12 @@ class FullPageTransformer extends Resource
...
@@ -14,9 +15,12 @@ class FullPageTransformer extends Resource
'is_home'
=>
$this
->
is_home
,
'is_home'
=>
$this
->
is_home
,
];
];
foreach
(
$this
->
translations
as
$pageTranslation
)
{
foreach
(
LaravelLocalization
::
getSupportedLocales
()
as
$locale
=>
$supportedLocale
)
{
$pageData
[
$pageTranslation
->
locale
]
=
$pageTranslation
;
foreach
(
$this
->
translatedAttributes
as
$translatedAttribute
)
{
$pageData
[
$locale
][
$translatedAttribute
]
=
$this
->
translateOrNew
(
$locale
)
->
$translatedAttribute
;
}
}
}
foreach
(
$this
->
tags
as
$tag
)
{
foreach
(
$this
->
tags
as
$tag
)
{
$pageData
[
'tags'
][]
=
$tag
->
name
;
$pageData
[
'tags'
][]
=
$tag
->
name
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment