namespace App\Http\Controllers;
use App\Models\SitemapUrl;
+use App\Models\Technique;
use App\Models\Tournament;
use Illuminate\Http\Request;
$urls[] = $url;
}
+ foreach (Technique::where('index', true)->get() as $tech) {
+ $url = new SitemapUrl();
+ $url->path = '/tech/'.rawurlencode($tech->name);
+ $url->lastmod = $tech->updated_at ? $tech->updated_at : ($tech->created_at ? $tech->created_at : now());
+ $url->changefreq = 'monthly';
+ $url->priority = $tech->priority;
+ $urls[] = $url;
+ }
+
return response()->view('sitemap', [
'urls' => $urls,
])->header('Content-Type', 'text/xml');
--- /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('techniques', function(Blueprint $table) {
+ $table->boolean('index')->default(false);
+ $table->float('priority')->default(0.5);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('rounds', function(Blueprint $table) {
+ $table->dropColumn('index');
+ $table->dropColumn('priority');
+ });
+ }
+};