# Usages

Payment is `polymorphic`, hence with the use of trait `HasPayable` can be used with any model.

```
use Pratiksh\Payable\Traits\HasPayable;

class Product extends Model
{
    use  HasPayable;
}
```

### HasPayable Available methods

#### payments

_**returns**_ Illuminate\Database\Eloquent\Relations\MorphMany

Retrieves the model payments record. `payments is polymorphic relation`

```
$product->payments;
```

***

#### pay

_**parameter**_&#x20;

* amount (float) : Payment amount to be registered

_**returns**_

* Pratiksh\Payable\Models\Payment

```
$product->pay(100)
```

***

#### modifyPay

_**parameter**_&#x20;

* payment(Pratiksh\Payable\Models\Payment) : Payment instance to be updated
* amount (float) : Payment amount to be updated

_**returns**_

* Pratiksh\Payable\Models\Payment

```
$product->modifyPay($product->payments()->latest()->first(),200) // Modified from 100 to 200
```



###
