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.'); } }