Code Duplication    Length = 17-18 lines in 2 locations

app/Http/Requests/Back/AddMediaRequest.php 1 location

@@ 8-24 (lines=17) @@
5
use App\Http\Requests\Request;
6
use Illuminate\Contracts\Validation\Validator;
7
8
class AddMediaRequest extends Request
9
{
10
    public function rules(): array
11
    {
12
        $rules = [
13
            'collection' => 'required',
14
            'file' => 'required|max:'.config('mediaLibrary.maxFileSize'),
15
        ];
16
17
        return $rules;
18
    }
19
20
    protected function failedValidation(Validator $validator)
21
    {
22
        return response()->json($validator->messages(), 400);
23
    }
24
}
25

app/Http/Requests/Back/ContentBlockRequest.php 1 location

@@ 8-25 (lines=18) @@
5
use App\Http\Requests\Request;
6
use Illuminate\Contracts\Validation\Validator;
7
8
class ContentBlockRequest extends Request
9
{
10
    public function rules(): array
11
    {
12
        return [
13
            'model_name' => 'required',
14
            'model_id' => 'required',
15
            'collection_name' => 'required',
16
        ];
17
18
        return $rules;
19
    }
20
21
    protected function failedValidation(Validator $validator)
22
    {
23
        return response()->json($validator->messages(), 400);
24
    }
25
}
26