$url = new SitemapUrl();
$url->path = '/tech';
- $url->lastmod = Technique::latest()->first()->created_at;
+ $url->lastmod = Technique::where('type', '=', 'tech')->where('index', true)->latest()->first()->created_at;
$url->changefreq = 'monthly';
$url->priority = 0.5;
$urls[] = $url;
- foreach (Technique::where('index', true)->get() as $tech) {
+ foreach (Technique::where('type', '=', 'tech')->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());
public function search(Request $request) {
$validatedData = $request->validate([
'phrase' => 'string|nullable',
+ 'type' => 'string|nullable',
]);
$techs = Technique::where('index', '=', 1);
+ if (!empty($validatedData['type'])) {
+ $techs = $techs->where('type', '=', $validatedData['type']);
+ }
+
if (!empty($validatedData['phrase'])) {
$search = $validatedData['phrase'];
$techs = $techs->where(function (Builder $query) use ($search) {
--- /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->string('type')->default('tech');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('techniques', function(Blueprint $table) {
+ $table->dropColumn('type');
+ });
+ }
+};
setLoading(true);
window.document.title = i18n.t('techniques.heading');
axios
- .get(`/api/tech`, { signal: ctrl.signal })
+ .get(`/api/tech`, {
+ params: {
+ type: 'tech',
+ },
+ signal: ctrl.signal
+ })
.then(response => {
setError(null);
setLoading(false);