Skip to content

Commit d836bb1

Browse files
committed
feat: #79 enable e-mail verification
1 parent 00ec406 commit d836bb1

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

app/Http/Controllers/TeamBillingController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ public function show(Team $team)
2525
'team' => $team,
2626
'customer' => $customer,
2727
'nextPayment' => $nextPayment,
28-
'subscription' => $team->subscription()->canceled() ? null : $team->subscription(),
28+
'subscription' => $team->subscription()?->canceled() ? null : $team->subscription(),
2929
'checkout' => $checkout->options(),
3030
'transactions' => $team->transactions,
31-
'updatePaymentMethodUrl' => $team->subscription()->paymentMethodUpdateUrl(),
32-
'cancelSubscriptionUrl' => $team->subscription()->cancelUrl(),
31+
'updatePaymentMethodUrl' => $team->subscription()?->paymentMethodUpdateUrl(),
32+
'cancelSubscriptionUrl' => $team->subscription()?->cancelUrl(),
3333
]);
3434
}
3535

app/Models/User.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace App\Models;
44

5-
// use Illuminate\Contracts\Auth\MustVerifyEmail;
5+
use Illuminate\Contracts\Auth\MustVerifyEmail;
66
use Illuminate\Database\Eloquent\Factories\HasFactory;
77
use Illuminate\Foundation\Auth\User as Authenticatable;
88
use Illuminate\Notifications\Notifiable;
@@ -11,7 +11,7 @@
1111
use Laravel\Jetstream\HasTeams;
1212
use Laravel\Sanctum\HasApiTokens;
1313

14-
class User extends Authenticatable
14+
class User extends Authenticatable implements MustVerifyEmail
1515
{
1616
use HasApiTokens;
1717
use HasFactory;

app/Notifications/TrialEndsSoonNotification.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ public function via(object $notifiable): array
4343
public function toMail(object $notifiable): MailMessage
4444
{
4545
$nextPayment = $this->team->subscription()->nextPayment();
46+
$dateDiff = $nextPayment->date->longRelativeToNowDiffForHumans();
4647

4748
return (new MailMessage)
48-
->line('Your trial ends soon.')
49-
->line("You will be charged {$nextPayment->amount()} on {$nextPayment->date->toDateTimeString()} ({$nextPayment->date->longRelativeToNowDiffForHumans()}).")
49+
->subject("Your trial ends in {$dateDiff}")
50+
->greeting("Hello {$this->team->customer->name}!")
51+
->line('Your trial for team '.$this->team->name.' ends soon.')
52+
->line("You will be charged {$nextPayment->amount()} on {$nextPayment->date->toDateTimeString()} ({$dateDiff}).")
5053
->action('Manage Subscription', url(route('teams.billing.show', $this->team)))
5154
->line('Any other questions? Contact us at '.config('app.email'));
5255
}

config/jetstream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
*/
5959

6060
'features' => [
61-
// Features::termsAndPrivacyPolicy(),
61+
Features::termsAndPrivacyPolicy(),
6262
// Features::profilePhotos(),
6363
Features::api(),
6464
Features::teams(['invitations' => true]),

resources/js/Layouts/AppLayout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const logout = () => {
7171
<button type="button" class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-800 hover:text-gray-700 dark:hover:text-gray-300 focus:outline-none focus:bg-gray-50 dark:focus:bg-gray-700 active:bg-gray-50 dark:active:bg-gray-700 transition ease-in-out duration-150">
7272
<span class="flex flex-col">
7373
<span>{{ $page.props.auth.user.current_team.name }}</span>
74-
<span v-if="$page.props.auth.user.current_team.billing.status === 'trialing'" class="text-xs text-amber-600">Trial ends {{dayjs($page.props.auth.user.current_team.billing.trial_ends_at).fromNow()}}</span>
74+
<span v-if="$page.props.auth.user.current_team.billing?.status === 'trialing'" class="text-xs text-amber-600">Trial ends {{dayjs($page.props.auth.user.current_team.billing.trial_ends_at).fromNow()}}</span>
7575
<!-- <span class="text-xs text-red-600">Payment Due</span>-->
7676
</span>
7777

resources/js/Pages/Auth/VerifyEmail.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ const verificationLinkSent = computed(() => props.status === 'verification-link-
4141
</PrimaryButton>
4242

4343
<div>
44-
<Link
45-
:href="route('profile.show')"
46-
class="underline text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800"
47-
>
48-
Edit Profile</Link>
44+
<!-- <Link-->
45+
<!-- :href="route('profile.show')"-->
46+
<!-- class="underline text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800"-->
47+
<!-- >-->
48+
<!-- Edit Profile</Link>-->
4949

5050
<Link
5151
:href="route('logout')"

0 commit comments

Comments
 (0)