input('disabled')); $node->update(['disabled' => $disabled]); return redirect()->back()->with('success', 'Node updated'); } /** * Remove the specified resource from storage. * * @param Node $node * @return Response */ public function destroy(Node $node) { // } /** * * @throws Exception */ public function sync(){ Node::query()->delete(); Location::query()->delete(); Node::syncNodes(); return redirect()->back()->with('success', 'Locations and Nodes have been synced'); } /** * @param Request $request * @return JsonResponse|mixed * @throws Exception */ public function dataTable(Request $request) { $query = Node::with(['location']); $query->select('nodes.*'); return datatables($query) ->addColumn('location', function (Node $node) { return $node->location->name; }) ->addColumn('actions', function (Node $node) { $checked = $node->disabled == false ? "checked" : ""; return '
' . csrf_field() . ' ' . method_field("PATCH") . '
'; }) ->editColumn('created_at' , function (Node $node) { return $node->created_at ? $node->created_at->diffForHumans() : ''; }) ->rawColumns(['actions']) ->make(); } }