Trying to access file in setting

I have added a file setting field into the settings that I have created but when trying to access it using the TwillAppSettings Face, it always seems to return null when I try to access it. Any idea how else I could access this? TIA.
No description
No description
2 Replies
pauldwight
pauldwight4mo ago
Hi @Strife You can get the file using the below approach
$brochureFile = A17\Twill\Facades\TwillAppSettings::getGroupDataForSectionAndName('site-settings', 'brochure');
// Below will return the URL
$brochureFile->file('single_file');
$brochureFile = A17\Twill\Facades\TwillAppSettings::getGroupDataForSectionAndName('site-settings', 'brochure');
// Below will return the URL
$brochureFile->file('single_file');
If you file isn't being saved in the settings then you need to make sure that you have included the single_file in your twill config
return [
'block_editor' => [
'crops' => [
...
],
'files' => ['single_file']
]
];
return [
'block_editor' => [
'crops' => [
...
],
'files' => ['single_file']
]
];
Strife
StrifeOP4mo ago
Thank you! I will give it a try! Worked beautifully, thank you!
Want results from more Discord servers?
Add your server