Skip to content

Commit 1c6a96b

Browse files
committed
Merge branch 'main' into add-sentry
2 parents 9f53133 + 9682b7c commit 1c6a96b

File tree

8 files changed

+366
-6
lines changed

8 files changed

+366
-6
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Notifications\TestNotification;
6+
use Illuminate\Console\Command;
7+
use Illuminate\Support\Facades\Mail;
8+
use Illuminate\Support\Facades\Notification;
9+
10+
class SendTestEmail extends Command
11+
{
12+
protected $signature = 'app:send-test-email {email}';
13+
14+
protected $description = 'Send a test email via the default mail driver.';
15+
16+
public function handle(): void
17+
{
18+
$this->info('Sending test email via '.Mail::getDefaultDriver().'...');
19+
20+
Notification::route('mail', $this->argument('email'))
21+
->notify(new TestNotification);
22+
}
23+
}

app/Exceptions/Handler.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Exceptions;
44

55
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6+
use Sentry\Laravel\Integration;
67
use Throwable;
78

89
class Handler extends ExceptionHandler
@@ -18,13 +19,10 @@ class Handler extends ExceptionHandler
1819
'password_confirmation',
1920
];
2021

21-
/**
22-
* Register the exception handling callbacks for the application.
23-
*/
2422
public function register(): void
2523
{
2624
$this->reportable(function (Throwable $e) {
27-
//
25+
Integration::captureUnhandledException($e);
2826
});
2927
}
3028
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace App\Notifications;
4+
5+
use Illuminate\Bus\Queueable;
6+
use Illuminate\Notifications\Messages\MailMessage;
7+
use Illuminate\Notifications\Notification;
8+
9+
class TestNotification extends Notification
10+
{
11+
use Queueable;
12+
13+
public function via(object $notifiable): array
14+
{
15+
return ['mail'];
16+
}
17+
18+
public function toMail(object $notifiable): MailMessage
19+
{
20+
return (new MailMessage)
21+
->subject('Test Notification')
22+
->greeting('It worked!')
23+
->line('This is a test mail notification.')
24+
->action('Go to Website', url(path: '/', secure: true));
25+
}
26+
}

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"sentry/sentry-laravel": "^4.13",
1717
"spatie/laravel-menu": "^4.1",
1818
"spatie/yaml-front-matter": "^2.0",
19+
"symfony/http-client": "^7.2",
20+
"symfony/mailgun-mailer": "^7.1",
1921
"torchlight/torchlight-commonmark": "^0.5.5"
2022
},
2123
"require-dev": {

composer.lock

Lines changed: 242 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/logging.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@
5454
'channels' => [
5555
'stack' => [
5656
'driver' => 'stack',
57-
'channels' => ['single'],
57+
'channels' => ['single', 'sentry'],
5858
'ignore_exceptions' => false,
5959
],
60-
60+
'sentry' => [
61+
'driver' => 'sentry',
62+
],
6163
'single' => [
6264
'driver' => 'single',
6365
'path' => storage_path('logs/laravel.log'),
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('cache', function (Blueprint $table) {
15+
$table->string('key')->primary();
16+
$table->mediumText('value');
17+
$table->integer('expiration');
18+
});
19+
20+
Schema::create('cache_locks', function (Blueprint $table) {
21+
$table->string('key')->primary();
22+
$table->string('owner');
23+
$table->integer('expiration');
24+
});
25+
}
26+
27+
/**
28+
* Reverse the migrations.
29+
*/
30+
public function down(): void
31+
{
32+
Schema::dropIfExists('cache');
33+
Schema::dropIfExists('cache_locks');
34+
}
35+
};

0 commit comments

Comments
 (0)