Turn uuid into object (file, page)

Is it possible to turn an uuid into an object without having to know if it’s a file or a page?

$modelA = Uuid::model("page://DJJe8CnSyjzGyeh0");
$modelB = Uuid::model("file://1OioPXGhbwDNLUUm");

Use case: building a panel section that displays links to pages and files based on a stored uuid.

I found $uuid->model() but learned that it doesn’t work on its own – only from classes that inherit from it (FileUuid, PageUuid etc).

AFAIK, you can use Uuid::for() like that

$model = \Kirby\Uuid\Uuid::for('page://DJJe8CnSyjzGyeh0')?->model();
1 Like

Thank you, that’s exactly what I was looking for :slight_smile: