CommentsController::store()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 10
rs 10
1
<?php
2
3
namespace Phpsa\Datastore\Http\Controllers;
4
5
use App\Http\Controllers\Controller;
0 ignored issues
show
Bug introduced by
The type App\Http\Controllers\Controller was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Illuminate\Http\Request;
7
8
use Phpsa\Datastore\Models\DatastoreComments;
9
10
class CommentsController extends Controller
11
{
12
    /**
13
     * Store a newly created resource in storage.
14
     *
15
     * @param  \Illuminate\Http\Request  $request
16
     * @return \Illuminate\Http\Response
17
     */
18
    public function store(Request $request)
19
    {
20
    	$request->validate([
21
			'body'=>'required',
22
			'datastore_id' => 'required'
23
        ]);
24
        $input = $request->all();
25
        $input['user_id'] = auth()->user()->id;
26
        DatastoreComments::create($input);
27
        return back();
0 ignored issues
show
Bug Best Practice introduced by
The expression return back() returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
28
    }
29
30
}