Git Product home page Git Product logo

laravel-roles-permissions-manager's Introduction

Laravel Roles Permissions Admin - Spatie version

Update October 2019: this project was created in 2017 as Laravel 5.4 version, and now we upgraded it to Laravel 6 version, also changed the design theme from AdminLTE to CoreUI


This is a Laravel 6 adminpanel starter project with roles-permissions management based on Spatie Laravel-permission package, CoreUI and Datatables.net.

We've also created almost identical project based on Joseph Silber's Bouncer package: see here

Part of this project was generated automatically by QuickAdminPanel system.

Roles Permissions screenshot

Roles Permissions screenshot 02

Usage

This is not a package - it's a full Laravel project that you should use as a starter boilerplate, and then add your own custom functionality.

  • Clone the repository with git clone
  • Copy .env.example file to .env and edit database credentials there
  • Run composer install
  • Run php artisan key:generate
  • Run php artisan migrate --seed (it has some seeded data - see below)
  • That's it: launch the main URL and login with default credentials [email protected] - password

This boilerplate has one role (administrator), one permission (users_manage) and one administrator user.

With that user you can create more roles/permissions/users, and then use them in your code, by using functionality like Gate or @can, as in default Laravel, or with help of Spatie's package methods.

License

The MIT license.

Notice

We are not responsible for any functionality or bugs in CoreUI, Laravel-permission or Datatables packages or their future versions, if you find bugs there - please contact vendors directly.


More from our LaravelDaily Team

laravel-roles-permissions-manager's People

Contributors

bellwood avatar laraveldaily avatar marius-k avatar pcrubianoa avatar povilaskorop avatar stutz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-roles-permissions-manager's Issues

QUESTION: Update AdminLTE?

It appears this project is using AdminLTE 2.3x, the latest version is 2.4.2 as of this writing.

Is there any plans to keep the bouncer/spatie projects up to date?

Thank you =)

Bouncer and Spatie ?

Hi,
How is this compare with Bouncer ?
Spatie version is better than Bouncer ?

CoreUI CDN version has changed, breaking layout

In admin.blade.php there is no specific version assigned to CoreUI. As of this morning, the CDN is pushing 3.0, last night it was 2.1.16. This breaks the navbar in the admin layout.

I've tried adding @2.1.16 to the css and js imports for CoreUI, but that does not work -- I may have not done it right because the direct links below seem to work?

It looks like a lot of classes changed between 2.1.x and 3.0, like navbar is now c-navbar. A full fix would be to find and change all those classes, but a monkeypatch is to download 2.1.16 and change the css and js to local references.

2.1.16 versions:
https://unpkg.com/@coreui/[email protected]/dist/css/coreui.min.css
https://unpkg.com/@coreui/[email protected]/dist/js/coreui.min.js

PHP Version Issue

When i run composer install i got this error

Problem 1
- Installation request for doctrine/annotations v1.6.0 -> satisfiable by doc
trine/annotations[v1.6.0].
- doctrine/annotations v1.6.0 requires php ^7.1 -> your PHP version (7.0.25)
does not satisfy that requirement.

How can i get rid of this without updating PHP version

SUGGESTION: Sort based on name, not object id

Rather than sort roles/permissions and permission "tags" (when adding to a role) by name, they are sorted by the objects id.

This makes readability poor if you later on decide to add additional permissions (they appear at the end of the list)

Would be nice to have these sorted by name instead.

Issue with textareas

Seems like every time I add a textarea to a create form, a default value is added to it without you specifying, and several js functionalities stop working, still going to try to debug this but thought I would give you a heads up, this is the default value (it is part of the admin.blade.php, not sure though why it interferes with textareas only)

                    <p class="helper-block">
            
          </p>
        </div>

        <div>
          <input class="btn btn-danger" type="submit" value="Save">
        </div>
      </form>
    </div>
  </div>

            </div>


        </main>
        <form id="logoutform" action="http://homestead.test/logout" method="POST" style="display: none;">
            <input type="hidden" name="_token" value="">
        </form>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
    <script src="https://unpkg.com/@coreui/coreui/dist/js/coreui.min.js"></script>
    <script src="//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
    <script src="//cdn.datatables.net/buttons/1.2.4/js/dataTables.buttons.min.js"></script>
    <script src="//cdn.datatables.net/buttons/1.2.4/js/buttons.flash.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.2.4/js/buttons.html5.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.2.4/js/buttons.print.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.2.4/js/buttons.colVis.min.js"></script>
    <script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script>
    <script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
    <script src="https://cdn.datatables.net/select/1.3.0/js/dataTables.select.min.js"></script>
    <script src="https://cdn.ckeditor.com/ckeditor5/11.0.1/classic/ckeditor.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.full.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.js"></script>
    <script src="http://homestead.test/js/main.js"></script>
    <script>
        $(function() {
  let copyButtonTrans = 'Copy'
  let csvButtonTrans = 'CSV'
  let excelButtonTrans = 'Excel'
  let pdfButtonTrans = 'PDF'
  let printButtonTrans = 'Print'
  let colvisButtonTrans = 'Column visibility'

  let languages = {
    'en': 'https://cdn.datatables.net/plug-ins/1.10.19/i18n/English.json'
  };

  $.extend(true, $.fn.dataTable.Buttons.defaults.dom.button, { className: 'btn' })
  $.extend(true, $.fn.dataTable.defaults, {
    language: {
      url: languages['en']
    },
    columnDefs: [{
        orderable: false,
        className: 'select-checkbox',
        targets: 0
    }, {
        orderable: false,
        searchable: false,
        targets: -1
    }],
    select: {
      style:    'multi+shift',
      selector: 'td:first-child'
    },
    order: [],
    scrollX: true,
    pageLength: 100,
    dom: 'lBfrtip<"actions">',
    buttons: [
      {
        extend: 'copy',
        className: 'btn-default',
        text: copyButtonTrans,
        exportOptions: {
          columns: ':visible'
        }
      },
      {
        extend: 'csv',
        className: 'btn-default',
        text: csvButtonTrans,
        exportOptions: {
          columns: ':visible'
        }
      },
      {
        extend: 'excel',
        className: 'btn-default',
        text: excelButtonTrans,
        exportOptions: {
          columns: ':visible'
        }
      },
      {
        extend: 'pdf',
        className: 'btn-default',
        text: pdfButtonTrans,
        exportOptions: {
          columns: ':visible'
        }
      },
      {
        extend: 'print',
        className: 'btn-default',
        text: printButtonTrans,
        exportOptions: {
          columns: ':visible'
        }
      },
      {
        extend: 'colvis',
        className: 'btn-default',
        text: colvisButtonTrans,
        exportOptions: {
          columns: ':visible'
        }
      }
    ]
  });

  $.fn.dataTable.ext.classes.sPageButton = '';
});

    </script>
    </body>

</html>

XXXXXXX.mass_destroy does not work!!

Hello Povilas,
I have tested your project, the Mass_Destroy Method does not work.
there is a message:
Status Code 405 Method Not Allowed.
do you have an idea why that does not work?
Thank you
Boudani
grafik

Combined migrations

What is combined migrations, inside combined folder?
Seem all migrations table are already in another file.

Route Error

in
Route::redirect('/', '/admin/home');
alter to
Route::redirect('/', 'admin/home');

how to use actionsTemplate.blade ?

Hey, first thanks for the wonderful application.

I saw a file actionsTemplate.blade on folder laravel-roles-permissions-manager/resources/views. but i don't see you using the file in any blade views.
I think using this can decrease a lot of effort to check the permission in ever action column on view. Can you provide me some example on how to use this actionTemplate on the view which share the same common functionality?

Relationships are missing

Hi
Some of the relationships of the models are missing eg user and role permission and roles . Can you explain why you didn't include other relationships on the project?

PHP 7 Issue

Your requirements could not be resolved to an installable set of packages.

Problem 1
- laravel/framework v5.5.9 requires php >=7.0 -> your PHP version (5.6.31) does not satisfy that requirement.

Error while composer install

Hi,

When I composer install, I get error as below:

`Generating optimized autoload files
Method Illuminate\Foundation\ComposerScripts::postAutoloadDump is not callable, can not call post-autoload-dump script

@php artisan package:discover

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

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1
PS C:\xampp\htdocs\laravel-daily-master>`

How can I solve it?

Thanks in advances.

Problem in the sidebar

Hi, i found a little bug, do you know how can i fix it?

bug

both mobile and desktop have the same error.

Thanks! ๐Ÿ‘

Database Migration error

OS: ubunto 16.04
When run this command
php artisan migrate --seed
I am getting error.Why this error occurred. Try to learning Laravel.
How can i solve this error?

[Illuminate\Database\QueryException]
could not find driver (SQL: select * from information_schema.tables w
here table_schema = forge and table_name = migrations)

[Doctrine\DBAL\Driver\PDOException]
could not find driver

[PDOException]
could not find driver

Editing and Adding problem

Hi, I have watched your article about laravel8 tutorials is the following link:
Laravel Jetstream: Add CRUD with Spatie Permission

I think this is very helpful for me!
But I have some questions about Editing and Adding task
I got these error when I wanted to add task name or edit:

Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameter for [Route: tasks.update] [URI: tasks/{task}] [Missing parameter: task]. (View: D:\Appserv\Apache24\htdocs\php7.4\interview_test\member-app\resources\views\tasks\edit.blade.php)

AND
Too few arguments to function App\Http\Requests\StoreTaskRequest::Illuminate\Foundation\Providers\{closure}(), 0 passed in D:\Appserv\Apache24\htdocs\php7.4\interview_test\member-app\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php on line 124 and exactly 1 expected

Add multiple role in permission

how can i add multiple role in permission menu?

if (! Gate::allows('users_manage')) { ////// i want to add here..
return abort(401);
}

Thanks

getting all users of same role

this doesn't seem to work

public function test() {

   return  $users = User::role('administrator')->get();

}

it returns
Non-static method App\User::role() should not be called statically

SUGGESTION: How to upgrade to L5.5 easily

For those wondering, yes, out of the box this package can be upgraded from L5.4 to L5.5 very easily (if you do it from the get go) following the instructions here:

https://laravel.com/docs/5.5/upgrade

The only bits they "forget" to tell you:

-update the php requirement to >= 7.0.0 in composer.json (the requirement is stated on the page, they just aren't verbose about making that change)

-run: "composer update" once you've made the changes

file config/panel.php is missing

in resources/view/layouts/admin.blade.php line 38
config/panel.php is been called for multiple languages, I would recommend the file to exist even if you attend to work on single language.

PDO::ATTR_STATEMENT_CLASS requires

SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); the classname must be a string specifying an existing class (SQL: select * from users where email = [email protected] limit 1)

User roles will not select in the user edit form

I found in the user edit form, user roles must be selected automatically but nothing will select.
Solution is change $user->roles->contains($id) to $user->roles()->pluck('name')->contains($id) in line 55 in this file.

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.