File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -178,20 +178,25 @@ public function destroy($field_id)
178178 */
179179 public function edit ($ id )
180180 {
181- $ field = CustomField::find ($ id );
181+ if ( $ field = CustomField::find ($ id )) {
182182
183- $ this ->authorize ('update ' , $ field );
183+ $ this ->authorize ('update ' , $ field );
184184
185- $ customFormat = '' ;
186- if ((stripos ($ field ->format , 'regex ' ) === 0 ) && ($ field ->format !== CustomField::PREDEFINED_FORMATS ['MAC ' ])) {
187- $ customFormat = $ field ->format ;
188- }
185+ $ customFormat = '' ;
186+ if ((stripos ($ field ->format , 'regex ' ) === 0 ) && ($ field ->format !== CustomField::PREDEFINED_FORMATS ['MAC ' ])) {
187+ $ customFormat = $ field ->format ;
188+ }
189189
190- return view ("custom_fields.fields.edit " ,[
191- 'field ' => $ field ,
192- 'customFormat ' => $ customFormat ,
193- 'predefinedFormats ' => Helper::predefined_formats ()
194- ]);
190+ return view ("custom_fields.fields.edit " ,[
191+ 'field ' => $ field ,
192+ 'customFormat ' => $ customFormat ,
193+ 'predefinedFormats ' => Helper::predefined_formats ()
194+ ]);
195+ }
196+
197+ return redirect ()->route ("fields.index " )
198+ ->with ("error " , trans ('admin/custom_fields/message.field.invalid ' ));
199+
195200 }
196201
197202
You can’t perform that action at this time.
0 commit comments