I am trying to make my resource return the data in this way (1) 2020-11-26 / 2020-11-27 (id) data_from / data_to is there any way to do that?
public function toArray($request)
{
    $parent_array = parent::toArray($request);
    $return_array = [];
    $return_array['id'] = $parent_array['id'];
    $return_array['text'] = $parent_array['data_from'];
    $return_array['text2'] = $parent_array['data_to'];
    return $return_array;
}
{
    "response": {
        "id": 1,
        "text": "2020-11-26",
        "text2": "2020-11-27"
    }
}
 
     
    