Store::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 2
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers\Topic;
4
5
use App\Http\Requests\ValidateTopicRequest;
6
use App\Models\Topic;
7
use Illuminate\Routing\Controller;
8
use Illuminate\Support\Facades\Auth;
9
10
class Store extends Controller
11
{
12
    public function __invoke(ValidateTopicRequest $request, Topic $topic)
13
    {
14
        $topic->fill($request->validated());
15
        $topic->user_id = Auth::id();
0 ignored issues
show
Bug introduced by
The property user_id does not exist on App\Models\Topic. Did you mean user?
Loading history...
16
        $topic->save();
17
18
        return [
19
            'message' => __('The topic was successfully created'),
20
            'redirect' => 'social.topics.edit',
21
            'param' => ['topic' => $topic->id],
22
        ];
23
    }
24
}
25