Passed
Push — master ( c2d3c3...2d4925 )
by Innocent
06:21
created

ContactController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 28
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A contact() 0 4 1
1
<?php
2
3
namespace Faithgen\Miscellaneous\Http\Controllers;
4
5
use Faithgen\Miscellaneous\Http\Requests\ContactCreateRequest;
6
use Faithgen\Miscellaneous\Services\ContactService;
7
use Illuminate\Routing\Controller;
8
9
class ContactController extends Controller
10
{
11
    /**
12
     * @var ContactService
13
     */
14
    private ContactService $contactService;
15
16
    /**
17
     * ContactController constructor.
18
     *
19
     * @param  ContactService  $contactService
20
     */
21
    public function __construct(ContactService $contactService)
22
    {
23
        $this->contactService = $contactService;
24
    }
25
26
    /**
27
     * Creates a query for the given user.
28
     *
29
     * @param  ContactCreateRequest  $request
30
     *
31
     * @return \Illuminate\Http\JsonResponse
32
     */
33
    public function contact(ContactCreateRequest $request)
34
    {
35
        return $this->contactService->create($request->validated(),
36
            'Your query was received, thanks for making contact');
37
    }
38
}
39