mardi 1 mars 2016

Custom Defined Routes in Laravel 5.2 Not Resolving

I have a new Laravel 5.2 application that is utilizing all the typical out-of-the-box routes for dashboard, cases, home, login/logout and users (which is working well). I now need to create a wizard with steps (step1, step2, step3, etc.) and I need access to the session so I assigned them to the group middleware.

Route::group(['middleware' => 'auth'], function () {
    Route::get('/', function () {
        // Uses Auth middleware
    });

    Route::get('wizard/step1', 'Wizard\WizardController@getStep1');
    Route::get('wizard/step2', 'Wizard\WizardController@getStep2');
});

However when I go to the named route(s) I get a 404 error. WizardController looks like:

<?php

namespace App\Http\Controllers\Wizard;

use App\Http\Requests;

class WizardController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }

    /**
     * Create the specified resource.
     */
    public function getStep1()
    {
        return view('wizard.step1');
    }
}

The views are defined as such: resources/views/wizard/step1.php. Ideally I'd like to refactor it so that Wizard is it's own separate group. However, nothing seems to currently work with the way I'm defining custom routing.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire