Show Pages

On the record's "show" page, it is recommended to display an alert when the record is locked and also hide the Edit/Delete buttons.

The show() method will need to pass the can_lock and locked_by.name attributes to Vue:

public function show(Example $example)
{
    return Inertia::render('Examples/PageIndex', [
        'example' => data($example, [
            // ...
            'can_lock',
            'lockedBy.name',
        ]),
    ]);
}

Then add this alert to the page in the #alerts slot:

<template #alerts>
    <AlertRecordLocked v-if="!example.can_lock" :locked-by="example.lockedBy" />
</template>

And hide any edit/delete buttons:

<ButtonEdit
    v-if="example.can_lock"
    ...
/>

Note: We can't use v-if="!example.lockedBy" here because it may be locked by the current user.