validate([ 'note' => 'required|string|max:500', 'type' => [ 'required', Rule::in(['asset']), ], ]); $item = Asset::findOrFail($request->input("id")); $this->authorize('update', $item); // This can be made dynamic by using $request->input('type') to determine which model type to add the note to. // For now, we are only placing this on Assets event(new NoteAdded($item, Auth::user(), $validated['note'])); return response()->json(Helper::formatStandardApiResponse('success')); } }