Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Learning and Work
managing-money-api
Commits
bc72fc3d
Commit
bc72fc3d
authored
Jun 18, 2018
by
Jack Stupple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fall back to a default language of english if a player does not have a language
parent
1e4cca7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
app/Player.php
app/Player.php
+15
-0
No files found.
app/Player.php
View file @
bc72fc3d
...
...
@@ -2,6 +2,7 @@
namespace
App
;
use
App\Language
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Http\Request
;
use
\
DB
;
...
...
@@ -107,4 +108,18 @@ class Player extends Model
return
$actual_position
;
}
public
function
getLanguageIdAttribute
()
{
if
(
isset
(
$this
->
attributes
[
'language_id'
]))
{
return
$this
->
attributes
[
'language_id'
];
}
$default_language
=
Language
::
where
(
'slug'
,
'en'
)
->
first
();
if
(
$default_language
)
{
return
$default_language
->
id
;
}
return
null
;
}
}
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