public static function boot() { parent::boot(); Account::created(function ($account) { // destiny stuff $data = new Data(); $data->account_id = $account->id; $data->membershipId = $account->destiny_membershipId; $data->save(); // halo 5 stuff $h5_data = new H5Data(); $h5_data->account_id = $account->id; $h5_data->save(); }); }
/** * Run the migrations. * * @return void */ public function up() { Schema::table('accounts', function (Blueprint $table) { $table->string('destiny_membershipId', 64); $table->dropIndex('accounts_id_index'); $table->index('destiny_membershipId'); }); \Onyx\Account::chunk(100, function ($accounts) { foreach ($accounts as $account) { $data = \Onyx\Destiny\Objects\Data::where('account_id', $account->id)->first(); $account->destiny_membershipId = $data->membershipId; $account->save(); } }); }
/** * Run the migrations. * * @return void */ public function up() { Schema::table('comments', function (Blueprint $table) { $table->integer('account_id', false, true); }); // Loop all comments, find account_id via membershipId \Onyx\Objects\Comment::chunk(100, function ($comments) { foreach ($comments as $comment) { $data = \Onyx\Destiny\Objects\Data::where('membershipId', $comment->membershipId)->first(); if ($data instanceof \Onyx\Destiny\Objects\Data) { $comment->account_id = $data->account_id; $comment->save(); } } }); }
/** * Run the migrations. * * @return void */ public function up() { Schema::table('game_players', function (Blueprint $table) { $table->integer('account_id', false, true); }); // Loop all game_players, find the account_id via membershipId on DestinyData \Onyx\Destiny\Objects\GamePlayer::chunk(100, function ($players) { foreach ($players as $player) { $data = \Onyx\Destiny\Objects\Data::where('membershipId', $player->membershipId)->first(); if ($data instanceof \Onyx\Destiny\Objects\Data) { $player->account_id = $data->account_id; $player->save(); } } }); }
/** * @param \Onyx\Destiny\Objects\Data $destiny * @param array $chars */ private function tabulateActivity($destiny, $chars) { $reset = false; foreach ($chars as $key => $value) { if ($value) { $reset = true; } } if ($reset) { $destiny->inactiveCounter = 0; $destiny->save(); } else { $destiny->inactiveCounter++; $destiny->save(); } }