File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,20 @@ public function saveLink(Request $request)
211211 $ linkTypePath = base_path ("blocks/ {$ linkType ->typename }/handler.php " );
212212 if (file_exists ($ linkTypePath )) {
213213 include $ linkTypePath ;
214- $ linkData = handleLinkType ($ request , $ linkType );
214+ $ result = handleLinkType ($ request , $ linkType );
215+
216+ // Extract rules and linkData from the result
217+ $ rules = $ result ['rules ' ];
218+ $ linkData = $ result ['linkData ' ];
219+
220+ // Validate the request
221+ $ validator = Validator::make ($ request ->all (), $ rules );
222+
223+ // Check if validation fails
224+ if ($ validator ->fails ()) {
225+ return back ()->withErrors ($ validator )->withInput ();
226+ }
227+
215228 $ linkData ['button_id ' ] = $ linkData ['button_id ' ] ?? 1 ; // Set 'button_id' unless overwritten by handleLinkType
216229 $ linkData ['type ' ] = $ linkType ->typename ; // Ensure 'type' is included in $linkData
217230 } else {
You can’t perform that action at this time.
0 commit comments