Commit d3ec0fc2 authored by Jack Stupple's avatar Jack Stupple

remove character location + update social support

parent 529d4fe1
......@@ -33,6 +33,7 @@ class Character extends Model
$player = get_player($_SERVER['HTTP_SESSION_ID'], false);
return $this->hasOne(\App\CharacterSocial::class)
->where('language_id', $player ? $player->language_id : \App\Language::where('slug', 'en')->first()->id)
->where('season_roundup_position', '=', $player ? $player->season_roundup_position : 0);
}
......
......@@ -217,7 +217,7 @@ class Initial extends Migration
DB::table('languages')->insert([
'name' => 'Français',
'slug' => 'fr',
'enabled' => getenv('APP_ENV') === 'local' ? $this->created_at : null,
'enabled' => $this->created_at,
'created_at' => $this->created_at
]);
......@@ -286,6 +286,7 @@ class Initial extends Migration
function (Blueprint $blueprint) {
$blueprint->increments('id');
$blueprint->integer('character_id');
$blueprint->integer('language_id');
$blueprint->integer('season_roundup_position');
$blueprint->string('body');
$blueprint->integer('likes');
......
......@@ -30,7 +30,6 @@ class ImportEmilyQuestions extends CharacterMigration
$this->character = new \App\Character();
$this->character->name = 'Emily';
$this->character->language_id = $this->language->id;
$this->character->enabled = $this->created_at;
$this->character->save();
......
......@@ -262,7 +262,6 @@ class ImportJakeQuestions extends Migration
$character = new \App\Character();
$character->name = 'Jake';
$character->language_id = $language->id;
$character->save();
return;
......
......@@ -29,7 +29,6 @@ class ImportJamalsQuestions extends CharacterMigration
$this->character = new \App\Character();
$this->character->name = 'Jamal';
$this->character->language_id = $this->language->id;
$this->character->enabled = $this->created_at;
$this->character->save();
......
......@@ -262,7 +262,6 @@ class ImportAnnQuestions extends Migration
$character = new \App\Character();
$character->name = 'Ann';
$character->language_id = $language->id;
$character->save();
return;
......
......@@ -6,6 +6,8 @@ use Illuminate\Database\Migrations\Migration;
class AddSocialText extends Migration
{
protected $language;
/**
* Run the migrations.
*
......@@ -13,6 +15,7 @@ class AddSocialText extends Migration
*/
public function up()
{
$this->language = \App\Language::where('slug', 'en')->first();
foreach (['emily', 'jake', 'jamal', 'ann'] as $_character) {
$character = \App\Character::where('name', 'LIKE', $_character)->first();
$json_path = APP_ROOT . '/resources/data/' . $_character . '/social-statuses.json';
......@@ -24,6 +27,7 @@ class AddSocialText extends Migration
foreach (json_decode(file_get_contents($json_path)) as $_status) {
$status = new \App\CharacterSocial();
$status->character_id = $character->id;
$status->language_id = $this->language->id;
$status->body = $_status->body;
$status->likes = $_status->likes;
$status->comments = $_status->comments;
......
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