3 ms·
We didn't find the lack of relational queries an obstacle at all. The model in Forward handles relationships in a way that makes it feel easy. Model fields can
by ericingram 14y ago
We didn't find the lack of relational queries an obstacle at all. The model in Forward handles relationships in a way that makes it feel easy. Model fields can be defined as a callback:
// class Accounts ...
'orders' => function ($account) {
return get("/orders", [account_id => $account['id']]);
}
Get an account, access the relationship:
{get $account from "/accounts/123"}
You have {pluralize "{$account.orders.count} orders"}
{foreach $account.orders as $order}
...
{/foreach}
This also works as expected:
{get $orders from "/accounts/123/orders"}
It would be cool if you built your platform on Forward. Just sayin' :)