Issues (2963)

app/Http/Controllers/ServiceController.php (1 issue)

1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Models\Service;
6
use Illuminate\Http\Request;
7
use Toastr;
8
9
class ServiceController extends Controller
10
{
11
    /**
12
     * Store a newly created resource in storage.
13
     *
14
     * @param  \Illuminate\Http\Request  $request
15
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response|\Illuminate\View\View
16
     */
17
    public function store(Request $request)
0 ignored issues
show
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

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

17
    public function store(/** @scrutinizer ignore-unused */ Request $request)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19
        $request = [
20
            'service_name' => 'required|string|unique:service',
21
            'device_id' => 'integer',
22
            'service_type' => 'string',
23
            'service_param' => 'nullable|string',
24
            'service_ip' => 'nullable|string',
25
            'service_desc' => 'nullable|string',
26
            'service_changed' => 'integer',
27
            'service_disabled' => 'integer',
28
            'service_ignore' => 'integer',
29
        ];
30
31
        $service = Service::make(
32
            $request->only(
33
                [
34
                    'service_name',
35
                    'device_id',
36
                    'service_type',
37
                    'service_param',
38
                    'service_ip',
39
                    'service_desc',
40
                    'service_changed',
41
                    'service_disabled',
42
                    'service_ignore',
43
                ]
44
            )
45
        );
46
        $service->save();
47
48
        Toastr::success(__('Service :name created', ['name' => $service->service_name]));
49
50
        return redirect()->route('services.templates.index');
51
    }
52
}
53