Get Tailor Global fields in API endpoint

I try to get Tailor Globals fields in api endpoint.
How can i do this?

I try print this…

<?php

use Tailor\Models\GlobalRecord;

Route::get('forms', function () {
    $config_forms = GlobalRecord::findForGlobal('Config\Forms');
    return $config_forms;
});

But I only get these parameters:

Hi @amristar, the global record is a dynamic model so although fields are defined, they need to set to some value to appear in the result.

The parameters here show that the model exists, but no values have been saved to it yet. Try opening it in the admin panel and clicking Save on the model.

Thanks for the clarification.
But, the data is already there and saved.

Thanks for the clarification. I see that you are using a repeater. This content is stored as a relationship and needs to be loaded. If the field was called social_links, the code would look like this…

$config = GlobalRecord::findForGlobal('Blog\Config');
$config->load('social_links');
return $config

Thank you!
It’s working! )

1 Like