GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 8c82e7...44f2dc )
by Nikhil
09:16
created

app/Http/Controllers/ModelController.php (2 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Events\ModelWasCreated;
6
use App\Events\ModelWasDeleted;
7
use App\Model;
8
use File;
9
use Illuminate\Http\Request;
10
11
class ModelController extends Controller
12
{
13
    /**
14
     * ModelController constructor.
15
     */
16 8
    public function __construct()
17
    {
18 8
        $this->middleware('auth');
19 8
    }
20
21
    /**
22
     * Display a listing of the resource.
23
     *
24
     * @return \Illuminate\Http\Response
25
     */
26 1
    public function index()
27
    {
28 1
        return view('models.index');
29
    }
30
31
    /**
32
     * Store a newly created resource in storage.
33
     *
34
     * @param  \Illuminate\Http\Request $request
35
     */
36 2
    public function store(Request $request)
37
    {
38 2
        $this->validate($request, [
39 2
            'name'    => 'required|string|max:255',
40
            'make_id' => 'required|exists:makes,id',
41
            'photo'   => 'required|image',
42
        ]);
43
        $photo    = $request->file('photo');
44
        $fileName = sha1(time() . $photo->getClientOriginalName()) . '.' . $photo->getClientOriginalExtension();
45
        $photo->move(config('shop.images.path'), $fileName);
46
        $model = Model::create($request->only([
47
                'name',
48
                'make_id'
49
            ]) + ['photo' => config('shop.images.dir') . $fileName]);
50
        event(new ModelWasCreated($model));
0 ignored issues
show
The call to ModelWasCreated::__construct() has too many arguments starting with $model.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
51
    }
52
53
    /**
54
     * Remove the specified resource from storage.
55
     *
56
     * @param  int $id
57
     */
58 2
    public function destroy($id)
59
    {
60 2
        $model = Model::findOrFail($id);
61 2
        File::delete(public_path($model->photo));
62 2
        $model->delete();
63 2
        event(new ModelWasDeleted($model));
0 ignored issues
show
The call to ModelWasDeleted::__construct() has too many arguments starting with $model.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
64 2
    }
65
}
66