Skip to content

Commit 2a56da4

Browse files
authored
Fix nullable lemon_squeezy_id on customers table (#50)
* Check lemon_squeezy_id on customer * Fix code styling * Make lemon_squeezy_id on customers nullable * Update ManagesCustomer.php * Update ManagesCustomer.php --------- Co-authored-by: driesvints <[email protected]>
1 parent 06b3d93 commit 2a56da4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

database/migrations/2023_01_16_000001_create_customers_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function up(): void
1212
$table->id();
1313
$table->unsignedBigInteger('billable_id');
1414
$table->string('billable_type');
15-
$table->string('lemon_squeezy_id')->unique();
15+
$table->string('lemon_squeezy_id')->nullable()->unique();
1616
$table->timestamp('trial_ends_at')->nullable();
1717
$table->timestamps();
1818

src/Concerns/ManagesCustomer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function redirectToCustomerPortal(): RedirectResponse
9595
*/
9696
protected function assertCustomerExists(): void
9797
{
98-
if (is_null($this->customer)) {
98+
if (is_null($this->customer) || is_null($this->customer->lemon_squeezy_id)) {
9999
throw InvalidCustomer::notYetCreated($this);
100100
}
101101
}

0 commit comments

Comments
 (0)