Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Fatal error: Cannot redeclare getModelForGuard() #9

Closed
danishjamil opened this issue Mar 7, 2018 · 4 comments
Closed

PHP Fatal error: Cannot redeclare getModelForGuard() #9

danishjamil opened this issue Mar 7, 2018 · 4 comments

Comments

@danishjamil
Copy link

Hi,

I'm getting the following issue when using spatie/laravel-permission and vanillo/framework together.

PHP Fatal error: Cannot redeclare getModelForGuard() (previously declared in C:....\vendor\konekt\acl\src\Support\helpers.php:8) in C:....\vendor\spatie\laravel-permission\src\helpers.php on line 14

I can see that konekt/acl is a modified version of spatie/laravel-permission package, and @fulopattila122 you are also one of the authors konekt/acl

Since both the definition and functionality is same so this issue can be avoided if following solution is implemented.

if(!function_exists('getModelForGuard') {
function getModelForGuard(string $guard)
{
return collect(config('auth.guards'))
->map(function ($guard) {
return config("auth.providers.{$guard['provider']}.model");
})->get($guard);
}
}

or rename the function from getModelForGuard to getGuardModel

Thanks.

@fulopattila122
Copy link
Member

Using both spatie/permission and konekt/acl is not supported. Since the two are the same, what is the benefit of using both?

@danishjamil
Copy link
Author

Basically i'm looking for a package to use for cart and other components of eCommerce (order, checkout, coupons) with active development going on and possibility of getting support for it, for that vanilo framework fit the bill.

I tried installing cart separately as a package but it didn't published the resources (config, migrations) in Laravel 5.5.

So i tried to install the framework but i got the following issue and saw that vanilo is using the modified version of spatie/permission which i'm already using it for handling user roles and permissions in my application.

Right now we are using "spatie/laravel-permission": "^2.7"

@fulopattila122
Copy link
Member

If you want to use just the components, then go without the framework. Let's see the other issue regarding to config/migrations. This one I'll close

@fulopattila122
Copy link
Member

I've added the solution for vanilophp/cart#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants