Skip to content

Commit

Permalink
fix rules for saving entity
Browse files Browse the repository at this point in the history
  • Loading branch information
temaotl committed Aug 14, 2024
1 parent 945d965 commit dfdb04e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 12 additions & 0 deletions app/Http/Requests/StoreEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,16 @@ public function rules()
'explanation' => 'required|max:255',
];
}

public function withValidator($validator)
{
$validator->after(function ($validator) {
$data = $validator->safe();

if (! empty($data['file']) && ! empty($data['metadata'])) {
$validator->errors()->add('file', 'You cannot provide both a file and metadata. Please choose one.');
$validator->errors()->add('metadata', 'You cannot provide both metadata and a file. Please choose one.');
}
});
}
}
7 changes: 0 additions & 7 deletions resources/views/federations/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
@extends('layouts.index')
@section('title', __('common.federations'))





@section('adminOnly_action')
<x-buttons.subhead href="{{ route('federations.import') }}">{{ __('common.import') }}</x-buttons.subhead>
<x-buttons.subhead href="{{ route('federations.refresh') }}">{{ __('common.refresh') }}</x-buttons.subhead>
Expand All @@ -25,7 +21,4 @@
@endif
@endif




@endsection

0 comments on commit dfdb04e

Please sign in to comment.