mercredi 25 juillet 2018

Why view::make doesn't work when called from a different function in controller?

This is a fairly simple question, and I made this work in other controllers, but I don't seem to be able to figure out what's exactly going on in this specific case, and why it's not working.

I have this two functions in my controller:

public function create(Request $request)
{
    //
    $this->edit($request, null);
}

public function edit(Request $request, Group $group = null)
{
    //

    return View::make('groups.create')
        ->with('controllerUrl', $this->controllerUrl)
        ->with('record', $group);
}

In this example the create function sends me to a blank page.

This is my route:

Route::group(['middleware'=>['web', 'CheckWritePermission']], function ()
{
    Route::resource('some_model', 'SomeModelController');
    Route::resource('model', 'ModelController');
    Route::resource('groups', 'GroupController');
});

For some reason doing it like this in other controllers works, and for some other it doesn't in this case.

I'm very confused as to why this is, because doing it like this works just fine.

public function create(Request $request)
{
    //
    // $this->edit($request, null);
    return View::make('groups.create')
        ->with('controllerUrl', $this->controllerUrl)
        ->with('record', $group);
}

I just want to understand why in some cases it works and in others it doesn't.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire