PHP code example of ayzerobug / laravel-external-references
1. Go to this page and download the library: Download ayzerobug/laravel-external-references 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/ */
ayzerobug / laravel-external-references example snippets
namespace App\Models;
use Ayzerobug\LaravelExternalReferences\Traits\HasExternalReferences;
class Payment extends Model
{
use HasExternalReferences;
...
}
use App\Models\Payment;
$payment = Payment::find($id);
$idOnPaystack = "random-id";
$payment->setExternalReference($idOnPaystack, 'paystack');
use App\Models\Payment;
$payment = Payment::find($id);
$idOnPaystack = $payment->getExternalReference('paystack');
use App\Models\Payment;
$idOnPaystack = "random-id";
$payment = Payment::findByExternalReference($idOnPaystack, 'paystack');