Domanda

I have the following route that does not want to work:

Route::get ('address/{id}/assign', array('uses' => 'AddressesController@assign'));

I have the following method in AddressesController.php:

public function assign() {
    print 'HELLO'; die();
}

I am trying to access:

http://localhost/address/1/assign

But it is NOT hitting the assign function. I keep getting:

Method [assign] does not exist.

Any ideas why?

UPDATE

I've tried all these variations:

public function assign($id)
{
    print 'XXX'; die();
}

public function getAssign($id)
{
    print 'XXX'; die();
}

public function postAssign($id)
{
    print 'XXX'; die();
}

public function assignAction($id)
{
    print 'XXX'; die();
}

public function actionAssign($id)
{
    print 'XXX'; die();
}

ANOTHER UPDATE

I had another controller with the same class name. That is why it was causing issues. Be careful when you copy and paste folks. Someone please delete or close this...

È stato utile?

Soluzione

I think you need to add a parameter in you function declaration since you use one in your route ( {id} ).

Like this:

public function assign($id) {
    print 'HELLO'; die($id);
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top