Description
Description
I recently had to change the route of my collection, and I found that due to using eloquent-driver, all the entries of that collection became inaccessible afterwards, as the uri no longer matched the one in entries table
Perhaps a simple command will do the trick?
Claude.ai wrote this one
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Statamic\Facades\Entry;
class UpdateEntryUris extends Command
{
protected $signature = 'statamic:update-uris';
protected $description = 'Update entry URIs in database';
public function handle()
{
$entries = Entry::query()->where('collection', 'erlebnisse')->get();
foreach ($entries as $entry) {
$entry->save(); // This will trigger URI regeneration
$this->info("Updated URI for entry: {$entry->id()}");
}
$this->info('All URIs updated successfully');
}
}