PHPackages                             abather/mini-accounting - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. abather/mini-accounting

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

abather/mini-accounting
=======================

Create accounts for any model to withdraw and deposit to it.

1.0.0(2y ago)031MITPHPPHP ^8.1

Since Dec 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Abather/mini-accounting)[ Packagist](https://packagist.org/packages/abather/mini-accounting)[ Docs](https://github.com/abather/mini-accounting)[ RSS](/packages/abather-mini-accounting/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (13)Versions (2)Used By (0)

Create accounts for any model to withdraw and deposit to it
===========================================================

[](#create-accounts-for-any-model-to-withdraw-and-deposit-to-it)

[![Latest Version on Packagist](https://camo.githubusercontent.com/af2a12a70729407032550b06922b7e7e62b28ce52947696cf10d78c530c7b0ef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616261746865722f6d696e692d6163636f756e74696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abather/mini-accounting)[![Total Downloads](https://camo.githubusercontent.com/f7367480a27c2840e1cdec9922463cd2dcf0766e5b669674e7069c907a776f5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616261746865722f6d696e692d6163636f756e74696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abather/mini-accounting)

Adding an Account to Your Models and Tracking Transactions
----------------------------------------------------------

[](#adding-an-account-to-your-models-and-tracking-transactions)

To seamlessly integrate account functionality into your Laravel models and keep track of transactions, follow the steps outlined below.

### Installation

[](#installation)

Begin by installing the package via Composer:

```
composer require abather/mini-accounting
```

Next, publish and run the migrations:

```
php artisan vendor:publish --tag="mini-accounting-migrations"
php artisan migrate
```

You can also publish the configuration file:

```
php artisan vendor:publish --tag="mini-accounting-config"
```

The contents of the published configuration file (`config/mini-accounting.php`) will look like this:

```
return [
    "prevent_duplication" => true,
    "currency_precision" => 2
];
```

### Usage

[](#usage)

This package links two entities: **Accountable** (a model with an account) and **Referencable** (a document triggering account deposits or withdrawals).

#### Accountable

[](#accountable)

To make a model accountable, use the `HasAccountMovement` trait:

```
