1 | <?php |
||
11 | class NewsController extends Controller |
||
12 | { |
||
13 | /** |
||
14 | * Display a listing of the resource. |
||
15 | * |
||
16 | * @return \Illuminate\Http\Response |
||
17 | */ |
||
18 | public function index() |
||
22 | |||
23 | /** |
||
24 | * Show the form for creating a new resource. |
||
25 | * |
||
26 | * @return \Illuminate\Http\Response |
||
27 | */ |
||
28 | public function create() |
||
32 | |||
33 | /** |
||
34 | * Store a newly created resource in storage. |
||
35 | * |
||
36 | * @param NewsStoreRequest $request |
||
37 | * @return \Illuminate\Http\JsonResponse |
||
38 | */ |
||
39 | public function store(NewsStoreRequest $request) |
||
69 | |||
70 | /** |
||
71 | * Display the specified resource. |
||
72 | * |
||
73 | * @param int $id |
||
74 | * @return \Illuminate\Http\Response |
||
75 | */ |
||
76 | public function show($id) |
||
80 | |||
81 | /** |
||
82 | * Show the form for editing the specified resource. |
||
83 | * |
||
84 | * @param News $news |
||
85 | * @return \Illuminate\Http\Response |
||
86 | */ |
||
87 | public function edit(News $news) |
||
95 | |||
96 | /** |
||
97 | * Update the specified resource in storage. |
||
98 | * |
||
99 | * @param \Illuminate\Http\Request $request |
||
100 | * @param int $id |
||
101 | * @return \Illuminate\Http\Response |
||
102 | */ |
||
103 | public function update(Request $request, $id) |
||
107 | |||
108 | /** |
||
109 | * Remove the specified resource from storage. |
||
110 | * |
||
111 | * @param int $id |
||
112 | * @return \Illuminate\Http\Response |
||
113 | */ |
||
114 | public function destroy($id) |
||
118 | } |
||
119 |
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: