1. Go to this page and download the library: Download simplecms/payment library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphOne;
use SimpleCMS\Payment\HasPayment;
class Order extends Model implements HasPayment
{
public function payment(): MorphOne
{
return $this->morphOne(\SimpleCMS\Payment\Models\Payment::class, 'order');
}
public function getOrderKey(): string
{
return 'order_no';
}
}
use SimpleCMS\Payment\Enums\ChannelEnum;
use SimpleCMS\Payment\Facades\Payment;
$result = Payment::create($order, 99.99, ChannelEnum::Wechat->value, 'Test order');