protected function __construct(Discord $discord, DiscordBotCommand $cmd) {
$this->discord = $discord;
$this->command = $cmd;
+ if ($cmd->tournament && $cmd->tournament->locale) {
+ App::setLocale($cmd->tournament->locale);
+ }
}
protected function fetchGuild() {
->fetch($this->command->tournament->discord)
->then(function (Guild $guild) {
$this->guild = $guild;
- if ($guild->preferred_locale) {
+ if ($guild->preferred_locale && !($this->command->tournament && $this->command->tournament->locale)) {
App::setLocale($guild->preferred_locale);
}
return $guild;
--- /dev/null
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('tournaments', function(Blueprint $table) {
+ $table->string('locale')->nullable()->default(null);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('tournaments', function(Blueprint $table) {
+ $table->dropColumn('locale');
+ });
+ }
+};