Store   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 10 1
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