vanilophp / framework

The truly Laravel E-commerce Framework
https://vanilo.io
MIT License
810 stars 102 forks source link

PHP Fatal error: Cannot redeclare getModelForGuard() #9

Closed danishjamil closed 6 years ago

danishjamil commented 6 years ago

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 commented 6 years ago

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

danishjamil commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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