@php
$bankAccounts = $accounts->where('type', 'Bank')->sortBy('name');
$cashAccounts = $accounts->where('type', 'Cash')->sortBy('name');
$walletAccounts = $accounts->where('type', 'Wallet')->sortBy('name');
$systemAccounts = $accounts
->reject(fn($a) => in_array((string) ($a->type ?? ''), ['Bank', 'Cash', 'Wallet'], true))
->sortBy(fn($a) => sprintf('%s|%s', (string) ($a->type ?? ''), (string) ($a->name ?? '')));
@endphp
Example: move from Cash to Bank; fee will also reduce from the sending account.