| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function index($slug_sprint, $slug_type = null) |
||
| 21 | { |
||
| 22 | $issues = Issue::join('sprints', 'issues.sprint_id', 'sprints.id') |
||
| 23 | ->join('issue_types', 'issues.issue_type_id', 'issue_types.id'); |
||
| 24 | |||
| 25 | if (!is_null($slug_sprint) && !empty($slug_sprint)) { |
||
| 26 | $issues->where('sprints.slug', $slug_sprint); |
||
| 27 | } |
||
| 28 | |||
| 29 | if (!is_null($slug_type)) { |
||
| 30 | $issues->where('issue_types.slug', $slug_type); |
||
| 31 | } |
||
| 32 | |||
| 33 | $issues = $issues->orderby('issues.position', 'ASC') |
||
| 34 | ->select('issues.*')->paginate(env('APP_PAGINATE')); |
||
| 35 | |||
| 36 | return view('issue_types.index') |
||
|
|
|||
| 37 | ->with('issues', $issues); |
||
| 38 | } |
||
| 39 | } |
||
| 40 |
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: