# Code Base Docs

## Log System For SIP2
### Example

```php
use Services\Helpers\Sip2\Sip2LogBuilder;
# Create Incoming Message
(new Sip2LogBuilder)->incomingMessage("message example","000")->saveToLog();
# Create Outgoing Message
(new Sip2LogBuilder)->outgoingMessage("message example","000")->saveToLog();
# Create Neutral Message
(new Sip2LogBuilder)->neutralMessage("message example","000")->saveToLog();
# Empty All Logs
(new Sip2LogBuilder)->emptyLogs();
```






## Circulation Service, Checkin Checkout with all rules in one place
### Example
```php

    use Services\Helpers\CirculationService;

    # Prepare Service requirments
    $item = Item::find(25);
    $patron = Borrower::find(598);

    # Create new instance of the service and load Item and Patron
    $circulationService = new CirculationService;
    $circulationService->setItem($item);
    $circulationService->setPatron($patron);
    $circulationService->setTargetBranchID($patron->branche_id);

    # Checkout Example
    if($circulationService->isCheckoutPossible()){
        if($circulationService->processCheckout()){
            # Checkout Success
        }else{
            # Checkout Failed
        }
    }else{
        # Checkout Not Allowed
    }



    # Get Data (Patron,Issue Rule, Item, Biblioitem)
    dump($circulationService->getPatron());
    dump($circulationService->loadIssueRule());
    dump($circulationService->getIssueRule());
    dump($circulationService->getBiblioitem());
    dump($circulationService->getItem());

    # Use Internal Methods
    dump($circulationService->isItemOrdered());
    dump($circulationService->isItemOnHold());
    dump($circulationService->isItemIssued());
    dump($circulationService->isPatronExceedsMaxIssues());
    dump($circulationService->isPatronExceededFineCap());
```












