diff --git a/app/Http/Requests/StoreImageAnnotation.php b/app/Http/Requests/StoreImageAnnotation.php index 666737ed4..d2434d330 100644 --- a/app/Http/Requests/StoreImageAnnotation.php +++ b/app/Http/Requests/StoreImageAnnotation.php @@ -4,8 +4,9 @@ use Biigle\Image; use Biigle\Shape; +use Illuminate\Foundation\Http\FormRequest; -class StoreImageAnnotation extends StoreImageAnnotationLabelFeatureVector +class StoreImageAnnotation extends FormRequest { /** * The image on which the annotation should be created. @@ -33,10 +34,13 @@ public function authorize() */ public function rules() { - return array_merge(parent::rules(), [ + return [ + 'label_id' => 'required_without:feature_vector|integer|exists:labels,id', + 'feature_vector' => 'required_without:label_id|array|size:384', + 'confidence' => 'required|numeric|between:0,1', 'shape_id' => 'required|integer|exists:shapes,id', 'points' => 'required|array', - ]); + ]; } /** diff --git a/app/Http/Requests/StoreImageAnnotationLabelFeatureVector.php b/app/Http/Requests/StoreImageAnnotationLabelFeatureVector.php deleted file mode 100644 index 9cef59ff5..000000000 --- a/app/Http/Requests/StoreImageAnnotationLabelFeatureVector.php +++ /dev/null @@ -1,51 +0,0 @@ -annotation = ImageAnnotation::findOrFail($this->route('id')); - $this->label = Label::findOrFail($this->input('label_id')); - - return $this->user()->can('attach-label', [$this->annotation, $this->label]); - } - - /** - * Get the validation rules that apply to the request. - * - * @return array - */ - public function rules() - { - return [ - 'label_id' => 'required_without:feature_vector|integer|exists:labels,id', - 'feature_vector' => 'required_without:label_id|array|size:384', - 'confidence' => 'required|numeric|between:0,1', - ]; - } -}