Commit bc72fc3d authored by Jack Stupple's avatar Jack Stupple

fall back to a default language of english if a player does not have a language

parent 1e4cca7d
......@@ -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;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment