vendredi 19 juillet 2019

php: combining variable values of the same type?

I am new to PHP coming over from Javascript. I have 2 PHP methods. I'd like to combine them into one endpoint call. Can I push them into the same Array so they can come back in one call with one payload?

public function incompleteOrders()
{
    $orders = request()->user()->incompleteOrders();

    $data = $orders->toArray();

    return response($data, 200);
}

public function finishedOrders()
{
    $orders = request()->user()->finishedOrders();

    $data = $orders->toArray();

    return response($data, 200);
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire