handle account in trial and payment mode in laravel

Solutions on MaxInterview for handle account in trial and payment mode in laravel by the best coders in the world

showing results for - "handle account in trial and payment mode in laravel"
Nicola
27 Jan 2019
1namespace App\Console\Commands;
2
3use App\Mail\TrialExpiringSoon;
4use App\Team;
5use Exception;
6use Illuminate\Console\Command;
7use Illuminate\Support\Facades\Mail;
8
9class EmailTeamsWithExpiringTrials extends Command
10{
11    protected $signature = 'ohdear:email-teams-with-expiring-trials';
12
13    protected $description = 'Email teams with expiring trials.';
14
15    protected $mailsSent = 0;
16
17    protected $mailFailures = 0;
18
19    public function handle()
20    {
21        $this->info('Sending trial expiring soon mails...');
22
23        Team::all()
24            ->filter->onSoonExpiringTrial()
25            ->each(function (Team $team) {
26                $this->sendTrialEndingSoonMail($team);
27            });
28
29        $this->info("{$this->mailsSent} trial expiring mails sent!");
30				
31        if ($this->mailFailures > 0) {
32           $this->error("Failed to send {$this->mailFailures} trial expiring mails!");
33        }
34    }
35
36    protected function sendTrialEndingSoonMail(Team $team)
37    {
38        try {
39            if ($team->wasAlreadySentTrialExpiringSoonMail()) {
40                return;
41            }
42						
43            $this->comment("Mailing {$team->owner->email} (team {$team->name})");
44            Mail::to($team->owner->email)->send(new TrialExpiringSoon($team));
45
46            $this->mailsSent++;
47
48            $team->rememberHasBeenSentTrialExpiringSoonMail();
49        } catch (Exception $exception) {
50            $this->error("exception when sending mail to team {$team->id}", $exception);
51            report($exception);
52            $this->mailFailures++;
53        }
54    }
55}
56
queries leading to this page
laravel cashier documentationlaravel cashier stripe webhookslaravel billablelaravel cashier schedule subscriptionlaravel subscription functionlaravel stripe cashierlaravel cashier stripebillable laravel subscriptionstripe schedule subscription php cashierlaravel stripe cashier get duelaravel how to handle billing on a per user basismake user have to sign in to app again sign in with facebook phplaravel create payment methoddisable emails if a booking is cancelled laravellaravel cashier billing examplesget stripe pay invoice link from laravel cashierhow to use laravel 7 cashierlaravel create setup intentlaravel 7 cashierlaravel cashier invoiceslaravel cashier subscription tablelaravel cashier webhooksstripe cashier not storing in subscriptions table laravellaravel subscription to producthow to use cashier on php stripehandle account in trial and payment mode in laravellaravel subscription free triallaravel cashier single chargephp cashierlaravel prepaid billing susytemlaravel cashier for stripe installlaravel cashier check if billable model has stripe customerlaravel cashiercan we add more payment method to laravel cachierlaravel cashier without payment methodscashier laravellaravel cashier without stripestripe invoices laravellaravel stripe dueuse laravel cashier for storelaravel cashier controller examplehow to use laravel cashierlaravel cashier single charge tutorialstripe cashier laravel pluginlaravel update billing period endlaravel stripe cashier get invoice remain to paymentlaravel cashier swap after expirylaravel 7 cashier examplelaravel vapor laravel cashierhow to make payment system with paypal in phplaravel cashier newsubscription upon registration successfullaravel cashier do you have to use stripelaravel user payment accounthow to install cashier stripelaravel cashier assign free subscriptionlaravel cashier create a payment intentlaravel cashier create subscription on a different datelaravel cachierlaravel user subscriptionhow to make payment system in phplaravel cashier websitelaravel billing without paymentlaravel stripe dblaravel stripe cashier documentationlaravel store billslaravel capture payment details in databaselaravel create subscription with payment intentlaravel cashier subscriptions tablepermission with stripe subscription laravel 6membership plan payment in laravellaravel 6 subscription plan permissionadd payment method laravel cashierlaravel cashier stripe invoicelaravel subscription after trial what happenshow to make payment system in php 5chandle account in trial and payment mode in laravel