matthew.erskine's avatar

Request data missing when using custom request object

Can anyone explain this?

I've injected two request objects into this method as a demonstration of a problem I'm having with Lumen:

/**
     * Store a newly created resource in storage.
     *
     * @param  \App\Http\Requests\StoreTimetableRequest  $request
     * @param  \Illuminate\Http\Request $requestB
     * @return \Illuminate\Http\Response
     */
    public function store(StoreTimetableRequest $request, Request $requestB)
    {
        dd($request->input(), $requestB->input());
    }

Here is the output from this controller:

array(0) {
}
array(3) {
  ["id"]=>
  int(1)
  ["frequency"]=>
  string(5) "daily"
  ["outcome"]=>
  string(19) "http://google.co.uk"
}

But the strange part... here's my custom request class. It does nothing yet, however, when injecting this into the controller Lumen is detecting this as a GET request with no input params...

<?php

namespace App\Http\Requests;

use Illuminate\Http\Request as BaseRequest;

class StoreTimetableRequest extends BaseRequest
{
    //
}

Any ideas?

0 likes
1 reply

Please or to participate in this conversation.