Get "Select Component Text Value" Without Use DB
What I am trying to do:
To access the name property of the data selected in the select component (without reading from the database again)
What I did:
I can find the id of the data selected in the select component. With this id, I find the data in the database and access the name property.
My issue/the error:
We have already transferred the data to the select component. I show the name to the user in the select component. How can I access this with code.
Code:
function (Get $get){
$platfrom_name = '@';
if($get('platform_id')){
$platfrom_name = Platform::find($get('platform_id'))->name;
}
return $platfrom_name ;
}
2 Replies
You could cache the value somewhere when loading it from the Select then you don't have to load it again from the DB
Can you give a code example?
I am new here. thank you for your answers.