• Stars
    star
    128
  • Rank 281,044 (Top 6 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Roles and Permissions implementation on Laravel 5.4

Roles Permissions Laravel (RPL)

A stater kit with Roles and Permissions implementation on Laravel 5.4

Install

  1. To use it just clone the repo and composer install.
  2. Set the database connection
  3. To test the app run php artisan db:seed, our interactive seeder will take care of everything.

Add a new Resource

  1. Create desired resource by running
## Create Comment model with migration and resource controller
php artisan make:model Comment -mcr
  1. Register route for it.
Route::group( ['middleware' => ['auth']], function() {
    ...
    Route::resource('comments', 'CommentController');
});
  1. Now implement your controllers methods and use the Authorizable trait
use App\Authorizable;

class CommentController extends Controller
{
    use Authorizable;
    ...
  1. Now add the permissions for this new Comment model.
php artisan auth:permission Comment

That's it, you have added new resource controller which have full access control by laravel permissions.

auth:permission command

This command can be user to add or remove permission for a given model

## add permission
php artisan auth:permission Comment

## remove permissions
php artisan auth:permission Comment --remove

Author

Created by QCode.in

License

MIT license.

More Repositories

1

qTwitter

A Twitter like app build using Laravel Vue.js and GraphQL by http://www.qcode.in
PHP
63
star
2

qtube

Create REST API with authentication using Laravel Passport http://www.qcode.in/create-rest-api-authentication-using-laravel-passport/
PHP
57
star
3

qreader

RSS feed reader app build on Vue.js, Vuex, Element UI and PHP as backend.
JavaScript
37
star
4

db-settings

Store and manage setting in database
PHP
26
star
5

qrss

PHP API class for parsing RSS feed and returning JSON http://www.qcode.in/build-complete-rss-feed-reader-app-php-rss-json-api/
PHP
20
star
6

react-comments

A comment app build on ReactJs, checkout the tutorial on https://www.qcode.in/learn-react-by-creating-a-comment-app
JavaScript
19
star
7

vue-comments

A simple comment system using Vue.js v2 and PHP, SQLite for backend, here is the tutorial which covers how to build it http://www.qcode.in/getting-started-vue-js-making-comment-app/
Vue
16
star
8

laravel-dropzone

Reusable upload component in Laravel with Dropzone.js http://www.qcode.in/reusable-upload-component-in-laravel-with-dropzone-js/
PHP
16
star
9

TrainRider

Subscription with coupon using Laravel Cashier & Stripe demo application http://www.qcode.in/subscription-with-coupon-using-laravel-cashier-stripe
PHP
15
star
10

social-auth

Starter kit for Socialite integration with Facebook, Google, Twitter and Github login
PHP
14
star
11

vue-ajax-submit

Vue.js directive to submit and server-side validatate forms using AJAX http://www.qcode.in/vue-js-directive-to-submit-and-server-side-validatate-forms-using-ajax
JavaScript
3
star
12

laraApi

Starter kit to spin up a Laravel API with jwt, dingo and CORS support in seconds.
PHP
2
star