Zizaco / entrust

Role-based Permissions for Laravel 5
MIT License
6.05k stars 1.29k forks source link

Lumen support? #369

Open Zyles opened 8 years ago

Zyles commented 8 years ago

Would be nice.

Thanks.

xitude commented 8 years ago

+1

cschalenborgh commented 8 years ago

+1

funson86 commented 8 years ago

+1

abcsun commented 8 years ago

+1

saeedvz commented 8 years ago

+1

pashamesh commented 8 years ago

+1

ardianchen commented 8 years ago

how to install in lumen? thank you.

mauvm commented 8 years ago

I've got it working in Lumen:

  1. Install as usual (providers and aliases can be added to bootstrap/app.php)
  2. Modify vendor/zizaco/entrust/src/Entrust/EntrustServiceProvider.php to match https://github.com/mauvm/entrust/commit/394dbb71b997538e235fe711ab075d6f765a6736 (as long as my PR isn't merged)
  3. Make sure your config/auth.php looks like this (model and table are required by Entrust):

    'providers' => [
       'users' => [
           'driver' => 'eloquent',
           'model' => App\User::class,
           'table' => 'users',
       ],
    ],
  4. Configure as usual If you get the error This cache store does not support tagging make sure you're not using the file cache provider. Instead set it to array in .env or config/cache.php.
  5. Add models as usual

If you get errors like App\Role not found you need to create the Entrust config file. php artisan vendor:publish doesn't work in Lumen, so copy vendor/zizaco/entrust/src/config/config.php to config/entrust.php, modify it, and load it in bootstrap/app.php. This error occured because my models are in the App\Models namespace. Therefore I'm also using 'model' => App\Models\User::class in config/auth.php.

Hope it helps!

emitategh commented 7 years ago

If anyone gets

[Symfony\Component\Console\Exception\CommandNotFoundException] There are no commands defined in the "vendor" namespace.

Add: composer require laravelista/lumen-vendor-publish

And then publish

ihsanberahim commented 7 years ago

I trying to use this in my lumen. I follows all guides above.

but now i got error Class 'Blade' not found

*for now i disabled blade in the Entrust service provider and it fixed $this->bladeDirectives();

mauvm commented 7 years ago

@ihsanberahim You've possibly skipped this part of step 2: https://github.com/mauvm/entrust/commit/394dbb71b997538e235fe711ab075d6f765a6736#diff-fd67755a24979e24a74dd15b4c30d112R62

OMGZui commented 7 years ago

thanks

rei-gun commented 7 years ago

@mauvm can you help with my issue here: https://github.com/Zizaco/entrust/issues/806 ?

thanks heaps.