FormFieldsController::reorder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 5
rs 10
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Http\Requests\CreateFormFieldRequest;
6
use App\Http\Requests\FormFieldUpdateRequest;
7
use App\Models\FormField;
8
use App\Services\FormFieldsService;
9
use Illuminate\Http\Request;
10
11
class FormFieldsController
12
{
13
    public function create(CreateFormFieldRequest $request)
14
    {
15
        $field = FormFieldsService::createField($request);
16
17
        return response()->json($field, 201);
18
    }
19
20
    public function list(Request $request)
21
    {
22
        $fields = FormField::where('recruitment_id', $request->get('recruitment_id'))->orderBy('order')->get();
0 ignored issues
show
Bug introduced by
The method get() does not exist on Illuminate\Http\Request. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
        $fields = FormField::where('recruitment_id', $request->/** @scrutinizer ignore-call */ get('recruitment_id'))->orderBy('order')->get();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
23
24
        return response()->json($fields, 200);
25
    }
26
27
    public function update(FormFieldUpdateRequest $request, $fieldId)
28
    {
29
        $field = FormFieldsService::updateField($fieldId, $request);
30
31
        return response()->json($field, 200);
32
    }
33
34
    public function delete($fieldId)
35
    {
36
        FormFieldsService::deleteField($fieldId);
37
38
        return response()->json(null, 200);
39
    }
40
41
    public function reorder($dragId, $dropId)
42
    {
43
        $response = FormFieldsService::reorder($dragId, $dropId);
44
45
        return response()->json($response, 200);
46
    }
47
}
48