jeudi 1 octobre 2015

Controller method not found laravel

Hello i have been using implicit controllers for a hile now but today i am having an issue i just cannot understand, i have the following in my Route.php:

 /**
     * Purchase
     */
    Route::controllers([
        'purchase' => 'PurchaseController'
    ]);

and in my controller i have created this method:

public function nsano(NsanoRequest $request)
    {

        $data = [
            'code' => $request->code,
            'msg' => $request->msg,
            'reference' => $request->referencecode
        ];

        if ($request->code == "00")
        {
            Session::put('nsano_callback_post_data', $data);

            return [
                'code' => '00',
                'msg' => 'success'
            ];
        }
        else
        {
            return [
                'code' => '01',
                'msg' => 'rollback'
            ];
        }

    }

Now for some reason when i try and post to this URL: http://ift.tt/1Oaykn4

I get this error: "Controller Method Not Found" Which is odd for me because i can see the method right there.

I took out the $request and just used Input::get() instead and now it works can someone please explain this to me?

This is my request:

class NsanoRequest extends Request {

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'code' => 'required',
            'msg' => 'required',
            'reference' => 'required'
        ];
    }

}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire