For an API I am writing, in my routes file I have:
$app->get('item/{id}', 'ApiController@item');
$app->get('groupitems/{group}', 'ApiController@groupItems');
In my Controller I have the relevant two functions:
public function item($id, Request $request)
{
if ($this->isAuthorised($request->input('tenant_id'), $request->input('api_code'))) {
$item = Line::find($id);
if ($item) { ...
public function groupItems($id, Request $request)
{
if ($this->isAuthorised($request->input('tenant_id'), $request->input('api_code'))) {
$items = Line::where('tenant_id', $request->input('tenant_id'))->where('publish', true) ...
The calls are both made in exactly the same way, for example:
http://api.artlook.com/groupitems/29?tenant_id=2&api_code=o9rty43
Please don't try that as the URL is only on a local server at the moment.
My first function runs perfectly. The second one returns an error exception
Argument 2 passed to groupItems() must be an instance of Illuminate\Http\Request, string given
But they are identical and in the same controller. Help?