lnbits paid articles added

This commit is contained in:
HolgerHatGarKeineNode
2023-03-13 21:33:43 +01:00
parent 02d2fcce06
commit 094825ee20

View File

@@ -5,6 +5,7 @@ namespace App\Http\Livewire\News;
use App\Models\LibraryItem; use App\Models\LibraryItem;
use App\Traits\LNBitsTrait; use App\Traits\LNBitsTrait;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
use Livewire\Component; use Livewire\Component;
use RalphJSmit\Laravel\SEO\Support\SEOData; use RalphJSmit\Laravel\SEO\Support\SEOData;
use SimpleSoftwareIO\QrCode\Facades\QrCode; use SimpleSoftwareIO\QrCode\Facades\QrCode;
@@ -71,12 +72,14 @@ class InternArticleView extends Component
public function checkPaymentHash() public function checkPaymentHash()
{ {
$invoice = $this->check($this->checkid ?? $this->checkThisPaymentHash); $invoice = $this->check($this->checkid ?? $this->checkThisPaymentHash);
if ($invoice['paid']) { if (isset($invoice['paid']) && $invoice['paid']) {
$this->invoicePaid = true; $this->invoicePaid = true;
auth() auth()
->user() ->user()
->paidArticles() ->paidArticles()
->syncWithoutDetaching($this->libraryItem->id); ->syncWithoutDetaching($this->libraryItem->id);
} else {
Log::error(json_encode($invoice, JSON_THROW_ON_ERROR));
} }
} }