/** * Show the form for creating a new resource. * * @param int $id * @return \Illuminate\Http\Response */ public function create($id) { $this->authorize('EDIT_NODETYPES'); $nodetype = NodeType::findOrFail($id); $form = $this->getCreateForm($id); return $this->compileView('nodefields.create', compact('id', 'form', 'nodetype')); }
/** * Sets the node type by key and validates it * * @param int $id * @return NodeType */ public function setNodeTypeByKey($id) { $nodeType = NodeType::findOrFail($id); $this->nodeType()->associate($nodeType); $this->mailing = $nodeType->isTypeMailing(); }
/** * List the specified resource fields. * * @param int $id * @return Response */ public function nodes($id) { $this->authorize('ACCESS_NODES'); $nodetype = NodeType::findOrFail($id); $modelName = $nodetype->isTypeMailing() ? MailingNode::class : Node::class; $nodes = $modelName::where('node_type_id', $nodetype->getKey())->sortable()->paginate(); return $this->compileView('nodetypes.nodes', compact('nodetype', 'nodes'), trans('nodes.title')); }