Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credits and Debits and Entries #6

Open
adriangoris opened this issue Mar 18, 2019 · 2 comments
Open

Credits and Debits and Entries #6

adriangoris opened this issue Mar 18, 2019 · 2 comments

Comments

@adriangoris
Copy link
Contributor

adriangoris commented Mar 18, 2019

I can insert credits and debits into the table and retrieve the balance, but i cannot retrieve the entries.
It appears that entries are not being returned from withing the contoller.

public function show(Account $account, $id)
{
    $account = Account::find($id);
    $entries = $account->entries();
    $debits = $account->debits();
    $credits = $account->credits();
    $balance = $account->balance();
    return response()->json([
            'status'=>200,
            'type'=>'GET',
            'message'=>'OK: Successfully retrieved Account',
            'data'=>$account,
            'debits'=>$debits,
            'credits'=>$credits,
            'balance'=>$balance
    ]);
}
@adriangoris
Copy link
Contributor Author

In order to get it working in the meantime I added it to my accounts model:

public function entries() 
{ 
    return $this->morphMany('\FannyPack\Ledger\LedgerEntry', 'ledgerable'); 
}

@mpaannddreew
Copy link
Owner

mpaannddreew commented Mar 19, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants