diff --git a/app/Actions/NotificationChannels/AddChannel.php b/app/Actions/NotificationChannels/AddChannel.php index 24a5b706..1a9a1faa 100644 --- a/app/Actions/NotificationChannels/AddChannel.php +++ b/app/Actions/NotificationChannels/AddChannel.php @@ -5,6 +5,7 @@ use App\Models\NotificationChannel; use App\Models\User; use Exception; +use Illuminate\Support\Facades\Validator; use Illuminate\Validation\Rule; use Illuminate\Validation\ValidationException; @@ -17,10 +18,12 @@ class AddChannel */ public function add(User $user, array $input): void { + Validator::make($input, self::rules($input))->validate(); + $channel = new NotificationChannel([ 'user_id' => $user->id, 'provider' => $input['provider'], - 'label' => $input['label'], + 'label' => $input['name'], 'project_id' => isset($input['global']) && $input['global'] ? null : $user->current_project_id, ]); $channel->data = $channel->provider()->createData($input); @@ -63,7 +66,7 @@ public static function rules(array $input): array 'required', Rule::in(config('core.notification_channels_providers')), ], - 'label' => 'required', + 'name' => 'required', ]; return array_merge($rules, self::providerRules($input)); diff --git a/app/Actions/NotificationChannels/EditChannel.php b/app/Actions/NotificationChannels/EditChannel.php index 3eb01563..fcda82e4 100644 --- a/app/Actions/NotificationChannels/EditChannel.php +++ b/app/Actions/NotificationChannels/EditChannel.php @@ -13,7 +13,7 @@ class EditChannel public function edit(NotificationChannel $notificationChannel, User $user, array $input): void { $notificationChannel->fill([ - 'label' => $input['label'], + 'label' => $input['name'], 'project_id' => isset($input['global']) && $input['global'] ? null : $user->current_project_id, ]); $notificationChannel->save(); @@ -26,7 +26,7 @@ public function edit(NotificationChannel $notificationChannel, User $user, array public static function rules(array $input): array { return [ - 'label' => 'required', + 'name' => 'required', ]; } } diff --git a/app/Http/Controllers/NotificationChannelController.php b/app/Http/Controllers/NotificationChannelController.php new file mode 100644 index 00000000..9c09b1bc --- /dev/null +++ b/app/Http/Controllers/NotificationChannelController.php @@ -0,0 +1,72 @@ +authorize('viewAny', NotificationChannel::class); + + return Inertia::render('notification-channels/index', [ + 'notificationChannels' => NotificationChannelResource::collection(NotificationChannel::getByProjectId(user()->current_project_id)->simplePaginate(config('web.pagination_size'))), + ]); + } + + #[Get('/json', name: 'notification-channels.json')] + public function json(): ResourceCollection + { + $this->authorize('viewAny', NotificationChannel::class); + + return NotificationChannelResource::collection(NotificationChannel::getByProjectId(user()->current_project_id)->get()); + } + + #[Post('/', name: 'notification-channels.store')] + public function store(Request $request): RedirectResponse + { + $this->authorize('create', NotificationChannel::class); + + app(AddChannel::class)->add(user(), $request->all()); + + return back()->with('success', 'Notification channel created.'); + } + + #[Patch('/{notificationChannel}', name: 'notification-channels.update')] + public function update(Request $request, NotificationChannel $notificationChannel): RedirectResponse + { + $this->authorize('update', $notificationChannel); + + app(EditChannel::class)->edit($notificationChannel, user(), $request->all()); + + return back()->with('success', 'Notification channel updated.'); + } + + #[Delete('{notificationChannel}', name: 'notification-channels.destroy')] + public function destroy(NotificationChannel $notificationChannel): RedirectResponse + { + $this->authorize('delete', $notificationChannel); + + $notificationChannel->delete(); + + return to_route('notification-channels')->with('success', 'Notification channel deleted.'); + } +} diff --git a/app/Http/Resources/NotificationChannelResource.php b/app/Http/Resources/NotificationChannelResource.php new file mode 100644 index 00000000..3fb73cfe --- /dev/null +++ b/app/Http/Resources/NotificationChannelResource.php @@ -0,0 +1,27 @@ + + */ + public function toArray(Request $request): array + { + return [ + 'id' => $this->id, + 'project_id' => $this->project_id, + 'global' => is_null($this->project_id), + 'name' => $this->label, + 'provider' => $this->provider, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]; + } +} diff --git a/app/Models/NotificationChannel.php b/app/Models/NotificationChannel.php index 414e1c92..33c422d1 100644 --- a/app/Models/NotificationChannel.php +++ b/app/Models/NotificationChannel.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Notifications\NotificationInterface; +use Database\Factories\NotificationChannelFactory; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -14,11 +15,11 @@ * @property array $data * @property string $label * @property bool $connected - * @property int $project_id + * @property ?int $project_id */ class NotificationChannel extends AbstractModel { - /** @use HasFactory<\Database\Factories\NotificationChannelFactory> */ + /** @use HasFactory */ use HasFactory; use Notifiable; diff --git a/config/core.php b/config/core.php index 6724089c..64d57e66 100755 --- a/config/core.php +++ b/config/core.php @@ -520,6 +520,12 @@ \App\Enums\NotificationChannel::EMAIL => \App\NotificationChannels\Email::class, \App\Enums\NotificationChannel::TELEGRAM => \App\NotificationChannels\Telegram::class, ], + 'notification_channels_providers_custom_fields' => [ + \App\Enums\NotificationChannel::SLACK => ['webhook_url'], + \App\Enums\NotificationChannel::DISCORD => ['webhook_url'], + \App\Enums\NotificationChannel::EMAIL => ['email'], + \App\Enums\NotificationChannel::TELEGRAM => ['bot_token', 'chat_id'], + ], /* * storage providers diff --git a/resources/js/components/ui/dialog.tsx b/resources/js/components/ui/dialog.tsx index 8aca62fa..2d7d74f3 100644 --- a/resources/js/components/ui/dialog.tsx +++ b/resources/js/components/ui/dialog.tsx @@ -46,7 +46,7 @@ function DialogContent({ className, children, ...props }: React.ComponentProps {children} - + Close diff --git a/resources/js/components/ui/sheet.tsx b/resources/js/components/ui/sheet.tsx index e0c8083b..764b7409 100644 --- a/resources/js/components/ui/sheet.tsx +++ b/resources/js/components/ui/sheet.tsx @@ -59,7 +59,7 @@ function SheetContent({ {...props} > {children} - + Close diff --git a/resources/js/layouts/settings/layout.tsx b/resources/js/layouts/settings/layout.tsx index e73046d5..e0d33bce 100644 --- a/resources/js/layouts/settings/layout.tsx +++ b/resources/js/layouts/settings/layout.tsx @@ -1,5 +1,5 @@ import { type BreadcrumbItem, type NavItem } from '@/types'; -import { CloudIcon, CodeIcon, DatabaseIcon, ListIcon, UserIcon, UsersIcon } from 'lucide-react'; +import { BellIcon, CloudIcon, CodeIcon, DatabaseIcon, ListIcon, UserIcon, UsersIcon } from 'lucide-react'; import { ReactNode } from 'react'; import Layout from '@/layouts/app/layout'; @@ -34,6 +34,11 @@ const sidebarNavItems: NavItem[] = [ href: route('storage-providers'), icon: DatabaseIcon, }, + { + title: 'Notification Channels', + href: route('notification-channels'), + icon: BellIcon, + }, ]; export default function SettingsLayout({ children, breadcrumbs }: { children: ReactNode; breadcrumbs?: BreadcrumbItem[] }) { diff --git a/resources/js/pages/notification-channels/components/columns.tsx b/resources/js/pages/notification-channels/components/columns.tsx new file mode 100644 index 00000000..000e82b4 --- /dev/null +++ b/resources/js/pages/notification-channels/components/columns.tsx @@ -0,0 +1,185 @@ +import { ColumnDef } from '@tanstack/react-table'; +import DateTime from '@/components/date-time'; +import { NotificationChannel } from '@/types/notification-channel'; +import { Badge } from '@/components/ui/badge'; +import { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from '@/components/ui/dialog'; +import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'; +import { Button } from '@/components/ui/button'; +import { useForm } from '@inertiajs/react'; +import { LoaderCircleIcon, MoreVerticalIcon } from 'lucide-react'; +import FormSuccessful from '@/components/form-successful'; +import { FormEvent, useState } from 'react'; +import InputError from '@/components/ui/input-error'; +import { Form, FormField, FormFields } from '@/components/ui/form'; +import { Label } from '@/components/ui/label'; +import { Input } from '@/components/ui/input'; +import { Checkbox } from '@/components/ui/checkbox'; + +function Edit({ notificationChannel }: { notificationChannel: NotificationChannel }) { + const [open, setOpen] = useState(false); + const form = useForm({ + name: notificationChannel.name, + global: notificationChannel.global, + }); + + const submit = (e: FormEvent) => { + e.preventDefault(); + form.patch(route('notification-channels.update', notificationChannel.id)); + }; + return ( + + + e.preventDefault()}>Edit + + + + Edit {notificationChannel.name} + Edit notification channel + +
+ + + + form.setData('name', e.target.value)} /> + + + +
+ form.setData('global', !form.data.global)} /> + +
+ +
+
+
+ + + + + + +
+
+ ); +} + +function Delete({ notificationChannel }: { notificationChannel: NotificationChannel }) { + const [open, setOpen] = useState(false); + const form = useForm(); + + const submit = () => { + form.delete(route('notification-channels.destroy', notificationChannel.id), { + onSuccess: () => { + setOpen(false); + }, + }); + }; + return ( + + + e.preventDefault()}> + Delete + + + + + Delete {notificationChannel.name} + Delete notification channel + +
+

+ Are you sure you want to delete {notificationChannel.name}? +

+ +
+ + + + + + +
+
+ ); +} + +export const columns: ColumnDef[] = [ + { + accessorKey: 'id', + header: 'ID', + enableColumnFilter: true, + enableSorting: true, + enableHiding: true, + }, + { + accessorKey: 'provider', + header: 'Provider', + enableColumnFilter: true, + enableSorting: true, + }, + { + accessorKey: 'name', + header: 'Name', + enableColumnFilter: true, + enableSorting: true, + }, + { + accessorKey: 'global', + header: 'Global', + enableColumnFilter: true, + enableSorting: true, + cell: ({ row }) => { + return
{row.original.global ? yes : no}
; + }, + }, + { + accessorKey: 'created_at', + header: 'Created at', + enableColumnFilter: true, + enableSorting: true, + cell: ({ row }) => { + return ; + }, + }, + { + id: 'actions', + enableColumnFilter: false, + enableSorting: false, + cell: ({ row }) => { + return ( +
+ + + + + + + + + + +
+ ); + }, + }, +]; diff --git a/resources/js/pages/notification-channels/components/connect-notification-channel.tsx b/resources/js/pages/notification-channels/components/connect-notification-channel.tsx new file mode 100644 index 00000000..f301a744 --- /dev/null +++ b/resources/js/pages/notification-channels/components/connect-notification-channel.tsx @@ -0,0 +1,158 @@ +import { LoaderCircle } from 'lucide-react'; +import { Button } from '@/components/ui/button'; +import { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from '@/components/ui/dialog'; +import { useForm, usePage } from '@inertiajs/react'; +import { FormEventHandler, ReactNode, useEffect, useState } from 'react'; +import { Label } from '@/components/ui/label'; +import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; +import InputError from '@/components/ui/input-error'; +import { Form, FormField, FormFields } from '@/components/ui/form'; +import { Input } from '@/components/ui/input'; +import { SharedData } from '@/types'; +import { Checkbox } from '@/components/ui/checkbox'; + +type NotificationChannelForm = { + provider: string; + name: string; + global: boolean; +}; + +export default function ConnectNotificationChannel({ + providers, + defaultProvider, + onProviderAdded, + children, +}: { + providers: string[]; + defaultProvider?: string; + onProviderAdded?: () => void; + children: ReactNode; +}) { + const [open, setOpen] = useState(false); + + const page = usePage(); + + const form = useForm>({ + provider: 'email', + name: '', + global: false, + }); + + const submit: FormEventHandler = (e) => { + e.preventDefault(); + form.post(route('notification-channels.store'), { + onSuccess: () => { + setOpen(false); + if (onProviderAdded) { + onProviderAdded(); + } + }, + }); + }; + + useEffect(() => { + form.setData('provider', defaultProvider ?? 'email'); + }, [defaultProvider]); + + return ( + + {children} + + + Connect to notification channel + Connect to a new notification channel + +
+ + + + + + + + + form.setData('name', e.target.value)} + /> + + +
1 + ? 'grid grid-cols-2 items-start gap-6' + : '' + } + > + {page.props.configs.notification_channels_providers_custom_fields[form.data.provider]?.map((item: string) => ( + + + form.setData(item as keyof NotificationChannelForm, e.target.value)} + /> + + + ))} +
+ +
+ form.setData('global', !form.data.global)} /> + +
+ +
+
+
+ + + + + + +
+
+ ); +} diff --git a/resources/js/pages/notification-channels/index.tsx b/resources/js/pages/notification-channels/index.tsx new file mode 100644 index 00000000..48a7d787 --- /dev/null +++ b/resources/js/pages/notification-channels/index.tsx @@ -0,0 +1,40 @@ +import SettingsLayout from '@/layouts/settings/layout'; +import { Head, usePage } from '@inertiajs/react'; +import Container from '@/components/container'; +import Heading from '@/components/heading'; +import { Button } from '@/components/ui/button'; +import React from 'react'; +import ConnectNotificationChannel from '@/pages/notification-channels/components/connect-notification-channel'; +import { DataTable } from '@/components/data-table'; +import { columns } from '@/pages/notification-channels/components/columns'; +import { NotificationChannel } from '@/types/notification-channel'; +import { Configs } from '@/types'; + +type Page = { + notificationChannels: { + data: NotificationChannel[]; + }; + configs: Configs; +}; + +export default function NotificationChannels() { + const page = usePage(); + + return ( + + + +
+ +
+ + + +
+
+ + +
+
+ ); +} diff --git a/resources/js/pages/storage-providers/components/connect-storage-provider.tsx b/resources/js/pages/storage-providers/components/connect-storage-provider.tsx index f522bae3..4edc6a1a 100644 --- a/resources/js/pages/storage-providers/components/connect-storage-provider.tsx +++ b/resources/js/pages/storage-providers/components/connect-storage-provider.tsx @@ -66,7 +66,7 @@ export default function ConnectStorageProvider({ return ( {children} - + Connect to storage provider Connect to a new storage provider @@ -109,21 +109,27 @@ export default function ConnectStorageProvider({ /> - {page.props.configs.storage_providers_custom_fields[form.data.provider]?.map((item: string) => ( - - - form.setData(item as keyof StorageProviderForm, e.target.value)} - /> - - - ))} +
1 ? 'grid grid-cols-2 items-start gap-6' : '' + } + > + {page.props.configs.storage_providers_custom_fields[form.data.provider]?.map((item: string) => ( + + + form.setData(item as keyof StorageProviderForm, e.target.value)} + /> + + + ))} +
form.setData('global', !form.data.global)} /> diff --git a/resources/js/types/index.d.ts b/resources/js/types/index.d.ts index 294a925b..6ecf6617 100644 --- a/resources/js/types/index.d.ts +++ b/resources/js/types/index.d.ts @@ -41,6 +41,10 @@ export interface Configs { storage_providers_custom_fields: { [provider: string]: string[]; }; + notification_channels_providers: string[]; + notification_channels_providers_custom_fields: { + [provider: string]: string[]; + }; operating_systems: string[]; service_versions: { [service: string]: string[]; diff --git a/resources/js/types/notification-channel.d.ts b/resources/js/types/notification-channel.d.ts new file mode 100644 index 00000000..2827513e --- /dev/null +++ b/resources/js/types/notification-channel.d.ts @@ -0,0 +1,11 @@ +export interface NotificationChannel { + id: number; + project_id?: number; + global: boolean; + name: string; + provider: string; + created_at: string; + updated_at: string; + + [key: string]: unknown; +} diff --git a/tests/Feature/NotificationChannelsTest.php b/tests/Feature/NotificationChannelsTest.php index 6e092db9..91635f5e 100644 --- a/tests/Feature/NotificationChannelsTest.php +++ b/tests/Feature/NotificationChannelsTest.php @@ -3,12 +3,10 @@ namespace Tests\Feature; use App\Enums\NotificationChannel; -use App\Web\Pages\Settings\NotificationChannels\Index; -use App\Web\Pages\Settings\NotificationChannels\Widgets\NotificationChannelsList; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Support\Facades\Http; -use Livewire\Livewire; +use Inertia\Testing\AssertableInertia; use Tests\TestCase; class NotificationChannelsTest extends TestCase @@ -20,14 +18,13 @@ public function test_add_email_channel(): void { $this->actingAs($this->user); - Livewire::test(Index::class) - ->callAction('add', [ - 'provider' => NotificationChannel::EMAIL, - 'email' => 'email@example.com', - 'label' => 'Email', - 'global' => true, - ]) - ->assertSuccessful(); + $this->post(route('notification-channels.store'), [ + 'provider' => NotificationChannel::EMAIL, + 'email' => 'email@example.com', + 'name' => 'Email', + 'global' => true, + ]) + ->assertSessionDoesntHaveErrors(); /** @var \App\Models\NotificationChannel $channel */ $channel = \App\Models\NotificationChannel::query() @@ -47,16 +44,14 @@ public function test_cannot_add_email_channel(): void $this->actingAs($this->user); - Livewire::test(Index::class) - ->callAction('add', [ - 'provider' => NotificationChannel::EMAIL, - 'email' => 'email@example.com', - 'label' => 'Email', - 'global' => true, - ]) - ->assertNotified('Could not connect! Make sure you configured `.env` file correctly.'); + $this->post(route('notification-channels.store'), [ + 'provider' => NotificationChannel::EMAIL, + 'email' => 'email@example.com', + 'name' => 'Email', + 'global' => true, + ]); - /** @var \App\Models\NotificationChannel $channel */ + /** @var ?\App\Models\NotificationChannel $channel */ $channel = \App\Models\NotificationChannel::query() ->where('provider', NotificationChannel::EMAIL) ->where('label', 'Email') @@ -71,13 +66,12 @@ public function test_add_slack_channel(): void Http::fake(); - Livewire::test(Index::class) - ->callAction('add', [ - 'provider' => NotificationChannel::SLACK, - 'webhook_url' => 'https://hooks.slack.com/services/123/token', - 'label' => 'Slack', - ]) - ->assertSuccessful(); + $this->post(route('notification-channels.store'), [ + 'provider' => NotificationChannel::SLACK, + 'webhook_url' => 'https://hooks.slack.com/services/123/token', + 'name' => 'Slack', + ]) + ->assertSessionDoesntHaveErrors(); /** @var \App\Models\NotificationChannel $channel */ $channel = \App\Models\NotificationChannel::query() @@ -96,15 +90,16 @@ public function test_cannot_add_slack_channel(): void 'slack.com/*' => Http::response(['ok' => false], 401), ]); - Livewire::test(Index::class) - ->callAction('add', [ - 'provider' => NotificationChannel::SLACK, - 'webhook_url' => 'https://hooks.slack.com/services/123/token', - 'label' => 'Slack', - ]) - ->assertNotified('Could not connect'); + $this->post(route('notification-channels.store'), [ + 'provider' => NotificationChannel::SLACK, + 'webhook_url' => 'https://hooks.slack.com/services/123/token', + 'name' => 'Slack', + ]) + ->assertSessionHasErrors([ + 'provider' => 'Could not connect', + ]); - /** @var \App\Models\NotificationChannel $channel */ + /** @var ?\App\Models\NotificationChannel $channel */ $channel = \App\Models\NotificationChannel::query() ->where('provider', NotificationChannel::SLACK) ->first(); @@ -118,13 +113,12 @@ public function test_add_discord_channel(): void Http::fake(); - Livewire::test(Index::class) - ->callAction('add', [ - 'provider' => NotificationChannel::DISCORD, - 'webhook_url' => 'https://discord.com/api/webhooks/123/token', - 'label' => 'Discord', - ]) - ->assertSuccessful(); + $this->post(route('notification-channels.store'), [ + 'provider' => NotificationChannel::DISCORD, + 'webhook_url' => 'https://discord.com/api/webhooks/123/token', + 'name' => 'Discord', + ]) + ->assertSessionDoesntHaveErrors(); /** @var \App\Models\NotificationChannel $channel */ $channel = \App\Models\NotificationChannel::query() @@ -143,15 +137,16 @@ public function test_cannot_add_discord_channel(): void 'discord.com/*' => Http::response(['ok' => false], 401), ]); - Livewire::test(Index::class) - ->callAction('add', [ - 'provider' => NotificationChannel::DISCORD, - 'webhook_url' => 'https://discord.com/api/webhooks/123/token', - 'label' => 'Discord', - ]) - ->assertNotified('Could not connect'); + $this->post(route('notification-channels.store'), [ + 'provider' => NotificationChannel::DISCORD, + 'webhook_url' => 'https://discord.com/api/webhooks/123/token', + 'name' => 'Slack', + ]) + ->assertSessionHasErrors([ + 'provider' => 'Could not connect', + ]); - /** @var \App\Models\NotificationChannel $channel */ + /** @var ?\App\Models\NotificationChannel $channel */ $channel = \App\Models\NotificationChannel::query() ->where('provider', NotificationChannel::DISCORD) ->first(); @@ -165,14 +160,13 @@ public function test_add_telegram_channel(): void Http::fake(); - Livewire::test(Index::class) - ->callAction('add', [ - 'provider' => NotificationChannel::TELEGRAM, - 'bot_token' => 'token', - 'chat_id' => '123', - 'label' => 'Telegram', - ]) - ->assertSuccessful(); + $this->post(route('notification-channels.store'), [ + 'provider' => NotificationChannel::TELEGRAM, + 'bot_token' => 'token', + 'chat_id' => '123', + 'name' => 'Telegram', + ]) + ->assertSessionDoesntHaveErrors(); /** @var \App\Models\NotificationChannel $channel */ $channel = \App\Models\NotificationChannel::query() @@ -192,16 +186,17 @@ public function test_cannot_add_telegram_channel(): void 'api.telegram.org/*' => Http::response(['ok' => false], 401), ]); - Livewire::test(Index::class) - ->callAction('add', [ - 'provider' => NotificationChannel::TELEGRAM, - 'bot_token' => 'token', - 'chat_id' => '123', - 'label' => 'Telegram', - ]) - ->assertNotified('Could not connect'); + $this->post(route('notification-channels.store'), [ + 'provider' => NotificationChannel::TELEGRAM, + 'bot_token' => 'token', + 'chat_id' => '123', + 'name' => 'Telegram', + ]) + ->assertSessionHasErrors([ + 'provider' => 'Could not connect', + ]); - /** @var \App\Models\NotificationChannel $channel */ + /** @var ?\App\Models\NotificationChannel $channel */ $channel = \App\Models\NotificationChannel::query() ->where('provider', NotificationChannel::TELEGRAM) ->first(); @@ -213,12 +208,10 @@ public function test_see_channels_list(): void { $this->actingAs($this->user); - /** @var \App\Models\NotificationChannel $channel */ - $channel = \App\Models\NotificationChannel::factory()->create(); + \App\Models\NotificationChannel::factory()->create(); - $this->get(Index::getUrl()) - ->assertSuccessful() - ->assertSee($channel->label); + $this->get(route('notification-channels')) + ->assertInertia(fn (AssertableInertia $page) => $page->component('notification-channels/index')); } public function test_delete_channel(): void @@ -227,9 +220,9 @@ public function test_delete_channel(): void $channel = \App\Models\NotificationChannel::factory()->create(); - Livewire::test(NotificationChannelsList::class) - ->callTableAction('delete', $channel->id) - ->assertSuccessful(); + $this->delete(route('notification-channels.destroy', [ + 'notificationChannel' => $channel->id, + ])); $this->assertDatabaseMissing('notification_channels', [ 'id' => $channel->id,