public function code(Request $request, WidgetBoxHandler $handler, $id)
{
if (\Gate::denies('edit', new Instance('widgetbox.' . $id))) {
throw new AccessDeniedHttpException();
}
/** @var WidgetBox $widgetbox */
$widgetbox = $handler->find($id);
if ($widgetbox === null) {
throw new NotFoundWidgetBoxException();
}
return XePresenter::makeApi(['code' => $widgetbox->content]);
}