Conditions | 6 |
Paths | 32 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | public function saving(Post $post) |
||
16 | { |
||
17 | if (request()->filled('tags')) { |
||
18 | $post->tags()->sync(request('tags')); |
||
19 | } |
||
20 | |||
21 | if (request()->filled('category_id')) { |
||
22 | $post->category_id = request('category_id'); |
||
23 | } |
||
24 | |||
25 | if ( ! request()->filled('user_id')) { |
||
26 | $post->user_id = auth()->id(); |
||
|
|||
27 | } |
||
28 | |||
29 | if ( ! request()->filled('slug')) { |
||
30 | $post->setSlug(request('title')); |
||
31 | } |
||
32 | |||
33 | if (request()->filled('status')) { |
||
34 | $post->setStatus(request('status')); |
||
35 | } |
||
36 | } |
||
37 | |||
51 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: