You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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');
}
}
The text was updated successfully, but these errors were encountered:
Yes if you change the route all entries need re-saved. I would guess most dev's know this and would write a migration or console task to do this. I dont feel we need to include one in the add-on.
@duncanmcclean I notice this issue is slightly different to the one I raised regarding updating the slug on an entry. This issue is updating the route on the collection. I'm unsure if this is the same bug, but it seems related and I just wanted to ensure this distinction.
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
The text was updated successfully, but these errors were encountered: