Eloquent Storage
Here we show how to store data in database using Eloquent ORM.
Usage
Create an eloquent model:
<?php
class Payment extends Illuminate\Database\Eloquent\Model
{
protected $table = 'payments';
}Register a storage for it
// bootstrap/start.php
use Payum\LaravelPackage\Storage\EloquentStorage;
App::resolving('payum.builder', function(\Payum\Core\PayumBuilder $payumBuilder) {
$payumBuilder
->addStorage(Payment::class, new EloquentStorage(Payment::class))
;
});Models
The package provides two models Payum\LaravelPackage\Model\Token and Payum\LaravelPackage\Model\Payment which may be reused directly or extend with some custom logic. Here's the models schemas:
Payment:
The database schema could be generated like this
The storage could be registered like this
Token:
The database schema could be generated like this
The token storage could be registered like this
Supporting Payum
Payum is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:
Last updated