Support the ongoing development of Laravel.io →
Authentication
Last updated 2 weeks ago.
0

Only thing that catches my eye is in the composer.json I don't see.

"app/models",

Witch would make sense because no matter how many times you composer dump-autoload you don't have it were composer can even see the models directory.

Example: https://github.com/efficiently/laravel_authority-controller_ap...

Last updated 2 weeks ago.
0

@dragonfire1119 thanks for your reply. I actually removed app/models directory. I put my controllers, models (which I now called entities) in apps/src/IAPON/ directory where I also namespaced them. I did put back app/models as you suggested but I'm still getting the same Exception error.

Last updated 2 weeks ago.
0

Found the solution. It has something to do with efficiently/authority package.

UsersController.php

Before:

class UsersController extends BaseController {
	public function __construct()
	{
		$this->loadAndAuthorizeResource();
	}
// rest of the code...

Solution:

class UsersController extends BaseController {
	public function __construct()
	{
		$this->loadAndAuthorizeResource(['class' => "IAPON\\Entities\\User"]);
	}
// rest of the code...

Reference: https://github.com/efficiently/authority-controller/wiki/Authorizing-controller-actions

If the model class is namespaced differently than the controller you will need to specify the class option.

Last updated 2 weeks ago.
0

epcliff said:

Found the solution. It has something to do with efficiently/authority package.

UsersController.php

Before:

class UsersController extends BaseController {
  public function __construct()
  {
  	$this->loadAndAuthorizeResource();
  }
// rest of the code...

Solution:

class UsersController extends BaseController {
  public function __construct()
  {
  	$this->loadAndAuthorizeResource(['class' => "IAPON\\Entities\\User"]);
  }
// rest of the code...

Reference: https://github.com/efficiently/authority-controller/wiki/Authorizing-controller-actions

If the model class is namespaced differently than the controller you will need to specify the class option.

Glad that you found the problem I had a feeling that it was something with the package because I've never used it. I didn't realize that you moved the controllers ETC.. else where.

Last updated 2 weeks ago.
0

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

epcliff epcliff epcliff Joined 16 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.