|
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\API;
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
use App\Http\Requests\API\Action\CommentRequest;
|
|
|
+use App\Models\Action;
|
|
|
use App\Models\Enums\ActionObjectType;
|
|
|
use App\Models\Enums\ObjectAction;
|
|
|
use App\Repositories\ActionRepository;
|
|
@@ -55,4 +56,27 @@ class ActionController extends Controller
|
|
|
|
|
|
return $this->created();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * update comment
|
|
|
+ *
|
|
|
+ * @param CommentRequest $request
|
|
|
+ * @param string $id
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
+ */
|
|
|
+ public function updateComment(CommentRequest $request, string $id)
|
|
|
+ {
|
|
|
+ $action = Action::query()->findOrFail($id);
|
|
|
+
|
|
|
+ $actionObjectType = ActionObjectType::from($action->object_type);
|
|
|
+
|
|
|
+ $actionObjectType?->modelBuilderAllowed($action->object_id)
|
|
|
+ ->where("company_id", Auth::user()->company_id)
|
|
|
+ ->findOrFail($action->object_id);
|
|
|
+
|
|
|
+ $action->comment = $request->comment;
|
|
|
+ $action->save();
|
|
|
+
|
|
|
+ return $this->noContent();
|
|
|
+ }
|
|
|
}
|