. */ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Webhooks; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Webhook; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Log; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * Class ShowController */ class ShowController extends Controller { /** * DeleteController constructor. */ public function __construct() { parent::__construct(); // translations: $this->middleware( static function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-bolt'); app('view')->share('subTitleIcon', 'fa-bolt'); app('view')->share('title', (string)trans('firefly.webhooks')); return $next($request); } ); } /** * Delete account screen. * * @return Application|Factory|View */ public function index(Webhook $webhook) { if (false === config('firefly.allow_webhooks')) { Log::channel('audit')->warning(sprintf('User visits webhook #%d page, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } Log::channel('audit')->info(sprintf('User visits webhook #%d page.', $webhook->id)); $subTitle = (string)trans('firefly.show_webhook', ['title' => $webhook->title]); return view('webhooks.show', compact('webhook', 'subTitle')); } }