Professional Documents
Culture Documents
Easy Roles and Permissions in Laravel 5 - QCode PDF
Easy Roles and Permissions in Laravel 5 - QCode PDF
in/)
All about Full Stack Web Development
Home (http://www.qcode.in)
Contact (https://www.qcode.in/contact/)
Laravel 5
By Mohd Saqueib (https://www.qcode.in/author/qcode/) May 1, 2017 under Laravel
(https://www.qcode.in/category/laravel/)
Laravel comes with Authentication and Authorization out of the box, I have implemented many role
and permissions based system in the past, using laravel, it’s peace of cake. In this post, we are going to
implement a fully working and extensible roles and permissions on laravel 5. When we nish we will
have a starter kit which we can use for our any future project which needs roles and permissions
based access control (ACL).
Laravel Permissions
Although laravel comes with Policies to handle the authorization I wanted to have an option to just
create permissions in the database which we can manage by a UI in the admin panel, pretty standard.
we can implement our own role and permission from scratch but I am going to use spatie/laravel-
permission (https://github.com/spatie/laravel-permission) package for this. This package was inspired
by Je rey ways screencast and it’s very well maintained and very easy to use. It has everything we
need and plays very well with Laravel Gate and Policies implementations.
/
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
Once the installation is done, make necessary changes in .env so you can connect to a database.
Setup packages
We will use laravel authorization which comes bundled, let’s sca old it using auth:make command. It
will create a fully functional login, register and password reset features. Now that’s done, let’s pull
packages we will need in this app.
About (https://www.qcode.in/about/)
Apart from permissions package, I have also grabbed ash (https://github.com/laracasts/ ash) to
Contact
show noti (https://www.qcode.in/contact/)
cation alerts and laravelcollective html (https://laravelcollective.com/docs/5.3/html)to
create forms with the option to model bind them.
Learn more
'providers' => [
...
Spatie\Permission\PermissionServiceProvider::class,
Laracasts\Flash\FlashServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
...
],
'aliases' => [
...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
]
/
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Home (http://www.qcode.in)
Cool, now let’s start by publishing migration which comes from permissions package, which will create
Aboutfor(https://www.qcode.in/about/)
tables roles and permissions.
Contact (https://www.qcode.in/contact/)
Learn more
Great, now we need to create our Resource, I am going to create Post, Role, Permission models with
resource controller. User model is already present so we will use it.
/
Dedicated Hosting
QCode (https://www.qcode.in/)
All about Full Stack Web Development AdYour project deserves the perfect setup.
100% exible hardware con gurations!
Ad
Home About Contact
(http://www.qcode.in) velia.net
(https://www.qcode.in/about/) (https://www.qcode.in/contact/
Open
Home (http://www.qcode.in)
Spatie\Permission already have role and permissions model, we will just extend them in order to do
About
any (https://www.qcode.in/about/)
changes if needed in future.
Contact (https://www.qcode.in/contact/)
// Permission Model
class Permission extends \Spatie\Permission\Models\Permission { }
// Role Model
class Role extends \Spatie\Permission\Models\Role { }
We need to add HasRoles trait provided by the package to give the user all the power of laravel
permissions.
use Spatie\Permission\Traits\HasRoles;
/
Now we have all the boilerplate out of the way, let’s create simple database seeder so we can build
QCode (https://www.qcode.in/)
and test our app, you can read more about advance database seeding in this post
All(http://www.qcode.in/advance-interactive-database-seeding-in-laravel/),
about Full Stack Web Development open
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
/
QCode (https://www.qcode.in/)
public function run()
All about Full
{ Stack Web Development
// Ask for db migration refresh, default is no
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
if ($this->command->confirm('Do (https://www.qcode.in/contact/
you wish to refresh migration before seeding, i
// Call the php artisan migrate:refresh
$this->command->call('migrate:refresh');
Home (http://www.qcode.in)
$this->command->warn("Data cleared, starting from blank database.");
}
About (https://www.qcode.in/about/)
// Seed the default permissions
Contact (https://www.qcode.in/contact/)
$permissions = Permission::defaultPermissions();
// Explode roles
$roles_array = explode(',', $input_roles);
// add roles
foreach($roles_array as $role) {
$role = Role::firstOrCreate(['name' => trim($role)]);
Home (http://www.qcode.in)
} else {
Role::firstOrCreate(['name' => 'User']);
About (https://www.qcode.in/about/)
$this->command->info('Added only default user role.');
}
Contact (https://www.qcode.in/contact/)
// now lets seed some posts for demo
factory(\App\Post::class, 30)->create();
$this->command->info('Some Posts data seeded.');
$this->command->warn('All done :)');
}
/**
* Create a user with given role
*
* @param $role
*/
private function createUser($role)
{
$user = factory(User::class)->create();
$user->assignRole($role->name);
/
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Home (http://www.qcode.in)
Now add defaultPermissions in Permissions Model which we have created.
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
public static function defaultPermissions()
{
return [
'view_users',
'add_users',
'edit_users',
'delete_users',
'view_roles',
'add_roles',
'edit_roles',
'delete_roles',
'view_posts',
'add_posts',
'edit_posts',
'delete_posts',
];
}
Dedicated Hosting
AdYour project deserves the perfect setup.
100% exible hardware con gurations!
Ad
velia.net
Open
/
Post model factory contains only 2 leds, title and body. You should setup the migration and factory.
QCode (https://www.qcode.in/)
Now run the seeder using php artisan db:seed it should give an admin user which you can use to
All about Full Stack Web Development
login.
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
/
QCode (https://www.qcode.in/)
public function index()
All about
{ Full Stack Web Development
$result = User::latest()->paginate();
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
return view('user.index', compact('result')); (https://www.qcode.in/contact/
}
Home (http://www.qcode.in)
public function create()
{
About (https://www.qcode.in/about/)
$roles = Role::pluck('name', 'id');
return view('user.new', compact('roles'));
Contact (https://www.qcode.in/contact/)
}
// hash password
$request->merge(['password' => bcrypt($request->get('password'))]);
return redirect()->route('users.index');
}
// Update user
$user->fill($request->except('roles', 'permissions', 'password'));
$user->save();
flash()->success('User has been updated.');
return redirect()->route('users.index');
}
if( User::findOrFail($id)->delete() ) {
flash()->success('User has been deleted'); /
} else {
QCode (https://www.qcode.in/)
flash()->success('User not deleted');
All about Full
} Stack Web Development
Home (http://www.qcode.in)
private function syncPermissions(Request $request, $user)
{
About (https://www.qcode.in/about/)
// Get the submitted roles
$roles = $request->get('roles', []);
Contact$permissions
(https://www.qcode.in/contact/)
= $request->get('permissions', []);
$user->syncRoles($roles);
return $user;
}
Everything is commented and self-explanatory, it’s a simple controller to perform CRUD operation with
user level permission override so you can give access to certain permissions for the speci c user.
Now register the route for all the resource controllers.
/
QCode (https://www.qcode.in/)
Route::group( ['middleware' => ['auth']], function() {
All about Full Stack Web Development 'UserController');
Route::resource('users',
Route::resource('roles', 'RoleController');
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
Route::resource('posts', 'PostController'); (https://www.qcode.in/contact/
});
Home (http://www.qcode.in)
About
Go (https://www.qcode.in/about/)
ahead and create the PostController by yourself, you can always access the source code if need
help.
Contact (https://www.qcode.in/contact/)
Authorization
This is the main part, authorization will be in 2 level, rst is at the controller level and second in view
level. In view, if you don’t have permission to add_users then it doesn’t make sense to show Create
button. this can be done using @can('add_users') directive in blade template.
...
@can('add_users')
<a href="{{ route('users.create') }}" class="btn btn-primary btn-sm">
<i class="glyphicon glyphicon-plus-sign"></i> Create
</a>
@endcan
...
Similarly, if you don’t have access to edit_users you should not see the edit button or delete button
in the table.
/
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
<table class="table table-bordered table-striped table-hover" id="data-table">
Contact<thead>
(https://www.qcode.in/contact/)
<tr>
....
<th>Created At</th>
@can('edit_users', 'delete_users')
<th class="text-center">Actions</th>
@endcan
</tr>
</thead>
<tbody>
@foreach($result as $item)
<tr>
...
@can('edit_users')
<td class="text-center">
// action buttons
</td>
@endcan
</tr>
@endforeach
</tbody>
</table>
Now that’s ne, but some malicious user can still directly visit the URL and he will be able to access the
protected route. To prevent that we need protection on controller@method level.
Authorizable Trait
/
We can add $user->can() check in every method to handle authorization but it will make it more
QCode (https://www.qcode.in/)
di cult to maintain and since we will be using this in multiple resource controller it will be good to
All about Full Stack Web Development
extract out this logic in a trait which will handle the authorization automatically, sounds good! let’s do
it.
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
/
QCode (https://www.qcode.in/)
namespace App;
All about Full Stack Web Development
trait Authorizable
Home About Contact
(http://www.qcode.in)
{ (https://www.qcode.in/about/) (https://www.qcode.in/contact/
private $abilities = [
'index' => 'view',
Home (http://www.qcode.in)
'edit' => 'edit',
'show' => 'view',
About (https://www.qcode.in/about/)
'update' => 'edit',
'create' => 'add',
Contact (https://www.qcode.in/contact/)
'store' => 'add',
'destroy' => 'delete'
];
/**
* Override of callAction to perform the authorization before
*
* @param $method
* @param $parameters
* @return mixed
*/
public function callAction($method, $parameters)
{
if( $ability = $this->getAbility($method) ) {
$this->authorize($ability);
}
Contact (https://www.qcode.in/contact/)
In this trait we have to override the callAction method which gets called by the router to trigger
respective method on the resource controller, that’s good place to check the permission, so we get the
route name in users case it will be users.index, users.store, users.update etc.. we have mapped the
abilities to our resource controller route naming conventions.
what happens is when a user visits route named users.index , it gets translated into view_users
ability to check against in authorize($ability) method by getAbility() method, when user visits edit
page route users.edit it will be translated as edit_users and so on. by extracting this logic in a Trait
we will be able to apply authorization on any resource controller we wanted.
use App\Authorizable;
That’s it, your controller is protected, the only user who has permissions to visit certain route can
access it.
When user doesn’t have permission they get AuthorizationException exception, which is not very
friendly to end user, let’s handle this in global Handler so we can display a noti cation and send the
user back to dashboard if the try to visit some route which they don’t suppose to access.
/
AuthorizationException Exception Handler
QCode (https://www.qcode.in/)
Open the app/Exceptions/Handler.php and add this in render method
All about Full Stack Web Development
Contactreturn
(https://www.qcode.in/contact/)
parent::render($request, $exception);
}
flash()->warning($exception->getMessage());
return redirect()->route('home');
}
This will redirect back to home route with ash noti cation if user doesn’t have access to the action.
Role Management
Let’s create the roles management resource controller. which admin can use to create the new role
and give or change permission to them.
/
QCode (https://www.qcode.in/)
class RoleController extends Controller
All about
{ Full Stack Web Development
use Authorizable;
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
public function index()
{
Home (http://www.qcode.in)
$roles = Role::all();
$permissions = Permission::all();
About (https://www.qcode.in/about/)
return view('role.index', compact('roles', 'permissions'));
Contact (https://www.qcode.in/contact/)
}
if( Role::create($request->only('name')) ) {
flash('Role Added');
}
return redirect()->back();
}
/
return redirect()->route('roles.index');
QCode
} (https://www.qcode.in/)
All about
} Full Stack Web Development
Now lets add the views for role, create resources/views/role/index.blade.php with below markup.
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
/
QCode (https://www.qcode.in/)
@extends('layouts.app')
All about Full Stack Web Development
@section('title', 'Roles & Permissions')
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
@section('content')
<!-- Modal -->
Home (http://www.qcode.in)
<div class="modal fade" id="roleModal" tabindex="-1" role="dialog" aria-labelledby=
<div class="modal-dialog" role="document">
About (https://www.qcode.in/about/)
{!! Form::open(['method' => 'post']) !!}
Contact (https://www.qcode.in/contact/)
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label
<h4 class="modal-title" id="roleModalLabel">Role</h4>
</div>
<div class="modal-body">
<!-- name Form Input -->
<div class="form-group @if ($errors->has('name')) has-error @endif"
{!! Form::label('name', 'Name') !!}
{!! Form::text('name', null, ['class' => 'form-control', 'place
@if ($errors->has('name')) <p class="help-block">{{ $errors->fi
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
<div class="row">
<div class="col-md-5">
<h3>Roles</h3>
</div>
<div class="col-md-7 page-action text-right">
/
@can('add_roles')
QCode (https://www.qcode.in/)
<a href="#" class="btn btn-sm btn-success pull-right" data-toggle="moda
All about Full Stack Web Development
@endcan
</div>
Home About Contact
</div>
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
Home (http://www.qcode.in)
@forelse ($roles as $role)
{!! Form::model($role, ['method' => 'PUT', 'route' => ['roles.update', $role->
About (https://www.qcode.in/about/)
@if($role->name === 'Admin')
Contact (https://www.qcode.in/contact/)
@include('shared._permissions', [
'title' => $role->name .' Permissions',
'options' => ['disabled'] ])
@else
@include('shared._permissions', [
'title' => $role->name .' Permissions',
'model' => $role ])
@can('edit_roles')
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
@endcan
@endif
@empty
<p>No Roles defined, please run <code>php artisan db:seed</code> to seed some d
@endforelse
@endsection
/
QCode (https://www.qcode.in/)
<div class="panel panel-default">
All about Full Stack
<div Web Development
class="panel-heading" role="tab" id="{{ isset($title) ? str_slug($title) : 'p
<h4 class="panel-title">
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
<a role="button" (https://www.qcode.in/contact/
data-toggle="collapse" data-parent="#accordion" href="#dd-
{{ $title or 'Override Permissions' }} {!! isset($user) ? '<span class=
</a>
Home (http://www.qcode.in)
</h4>
</div>
About (https://www.qcode.in/about/)
<div id="dd-{{ isset($title) ? str_slug($title) : 'permissionHeading' }}" class="p
<div class="panel-body">
Contact (https://www.qcode.in/contact/)
<div class="row">
@foreach($permissions as $perm)
<?php
$per_found = null;
if( isset($role) ) {
$per_found = $role->hasPermissionTo($perm->name);
}
if( isset($user)) {
$per_found = $user->hasDirectPermission($perm->name);
}
?>
<div class="col-md-3">
<div class="checkbox">
<label class="{{ str_contains($perm->name, 'delete') ? 'tex
{!! Form::checkbox("permissions[]", $perm->name, $per_f
</label>
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
/
If you visit now /roles you can nd will be able to manage the roles and permission.
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
Permissions Management
Permissions are not going to be changed very often in most cases, you can just add them directly into
the database. I am leaving the implementation for this. It’s simple CRUD, if you wanted you can
implement it. One thing we can do to create a command which we can run to create permissions,
something like php artisan auth:permission tasks , which will create 'view_tasks',
'add_tasks', 'edit_tasks', 'delete_tasks' the permissions for tasks model, and if we pass --
remove it will delete permissions on it.
/
QCode (https://www.qcode.in/)
class AuthPermissionCommand extends Command
All about
{ Full Stack Web Development
protected $signature = 'auth:permission {name} {--R|remove}';
Home About Contact
(http://www.qcode.in)
... (https://www.qcode.in/about/) (https://www.qcode.in/contact/
} else {
// create permissions
foreach ($permissions as $permission) {
Permission::firstOrCreate(['name' => $permission ]);
}
/
return array_map(function($val) use ($name) {
QCodereturn
(https://www.qcode.in/)
$val . '_'. $name;
All about Full Stack
}, Web Development
$abilities);
}
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
private function getNameArgument()
{
Home (http://www.qcode.in)
return strtolower(str_plural($this->argument('name')));
}
About
} (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
Our command is ready, next let’s register it in Kernel, open the app/Console/Kernel.php and add.
App\Console\Commands\AuthPermissionCommand;
The auth:permission command is ready, now you can run it to add/remove permissions.
If you added permissions manually in the db, don’t forget to run php artisan
cache:forget spatie.permission.cache , otherwise new permissions wont work.
Finally, we have a starter kit which you can use for any new project required roles and permissions.
Check the source code & I hope you found it useful, let me know in the comments if you have any
question.
/
Source Code Laravel 5.4 (https://github.com/saqueib/roles-permissions-laravel)
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Source Code Laravel 5.7 (https://github.com/saqueib/roles-permissions-laravel/tree/v5.7)
(https://www.qcode.in/easy-roles-and-permissions-in-laravel-5-4/?share=email&nb=1)
Home (http://www.qcode.in)
(https://www.qcode.in/easy-roles-and-permissions-in-laravel-5-4/?share=twitter&nb=1)
(https://www.qcode.in/about/)
About
(https://www.qcode.in/easy-roles-and-permissions-in-laravel-5-4/?share=facebook&nb=1)
(https://www.qcode.in/contact/)
(https://www.qcode.in/easy-roles-and-permissions-in-laravel-5-4/?share=linkedin&nb=1)
Contact
(https://www.qcode.in/easy-roles-and-permissions-in-laravel-5-4/?share=reddit&nb=1)
(https://www.qcode.in/easy-roles-and-permissions-in-laravel-5-4/?share=pinterest&nb=1)
(https://www.qcode.in/easy-roles-and-permissions-in-laravel-5-4/?share=jetpack-whatsapp&nb=1)
Related
Build complete RSS feed reader app – Front-end with Vue.js, Vuex & Element UI
(https://www.qcode.in/build-complete-rss-feed-reader-app-front-end-with-vue-js-vuex-element-ui/)
Convert Vue.js app to Native desktop app using Electron (https://www.qcode.in/convert-vue-js-app-
native-desktop-app-using-electron/)
/
141 Responses to “Easy roles and permissions in Laravel 5”
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Very nice, thanks for writing this. I’ll add a link to this tutorial in the readme of the
Home — Freek Van der package. About Contact
(http://www.qcode.in)
Herten (https://www.qcode.in/about/) (https://www.qcode.in/contact/
(https://murze.be/)
May 1, 2017
(https://www.qcode.in/easy That will be great, thanks for simple and awesome
Home (http://www.qcode.in)
-roles-and-permissions-in-
laravel-5-4/#comment-16) — Saqueib package for laravel permissions
May 1, 2017
About (https://www.qcode.in/about/)
(https://www.qcode
.in/easy-roles-and-
permissions-in-
Contact (https://www.qcode.in/contact/)
laravel-5-
4/#comment-17)
I added one custom permission directly to the database (not crud permission) and
— bambamboole the template breaks. Do you have any solution for this?
May 6, 2017
(https://www.qcode.in/easy
-roles-and-permissions-in-
laravel-5-4/#comment-20)
You can always fallback to
— Saqueib @can('your_custom_permissions') in blade template.
May 6, 2017
(https://www.qcode same is true for controller Auth::user()-
.in/easy-roles-and-
>can('your_custom_permissions') or you can use
permissions-in-
laravel-5- authorized like this
4/#comment-21)
/
QCode (https://www.qcode.in/)
$this->authorize('your_custom_permissions');
All about Full Stack Web Development
I would suggest pick a naming convention for route and
Home About permission and stick to it, you can also
Contact
match the
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
$abilities array in Authorizable traits line number 15
Home (http://www.qcode.in)
If you need any further help, please share your custom
route and some permissions you wanted to add. by
About (https://www.qcode.in/about/)
default a permission name is made of
Contact (https://www.qcode.in/contact/)
{controller_method}_{route_name} see the trait.
/
QCode (https://www.qcode.in/)
if you can give me the
— permissions you have
All about Full Stack Web Development
Saquei
added that will be very
b
Home About
May 8, helpful to reproduce Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
2017 (https://www.qcode.in/contact/
(https:// this error at my end.
www.qc
ode.in/e
Home (http://www.qcode.in) asy-
roles-
and-— I just
ba added a
About (https://www.qcode.in/about/)
permissi
ons-in- mb
laravel-
new
am
Contact (https://www.qcode.in/contact/)
5-
boo permission
4/#com
le via Sequel
ment-
May
24)
10, Pro called
2017
(http
custom_permissi
s://w nothing
ww.
qcod more.
e.in/
After
easy
- adding this
roles
- permission
and-
the
per
miss permission
ions-
in- template
larav
breaks…
el-5-
4/#c
om
men
t-25)
— Worked
Josh out the
June
8, issue. After
2017
adding a
(http
s://w permission
ww.
qcod
via Sequal
e.in/ Pro you
easy
- need to
roles
-
run `php
and-
per
/
miss
artisan
QCode (https://www.qcode.in/)
ions-
cache:forget in-
larav
All about Full Stack Web Development el-5-
spatie.permission
4/#c
Home About om Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
men (https://www.qcode.in/contact/
t-31)
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
— Heya, If I
Josh try and
June
Contact (https://www.qcode.in/contact/)
8, add a
2017
custom
(http
s://w permission
ww.
qcod
called
e.in/ ‘access_sta _pan
easy
- it would
roles
-
break the
and- permissions
per
miss blade
ions-
saying .
in-
larav “There is
el-5-
4/#c no
om
permission
men
t-30) named
`access_sta _pa
for guard
`web`.” As
mentioned
I did this
just using
Sequal Pro,
how would
I go about
adding a
custom
permission
that I can
/
assign to
QCode (https://www.qcode.in/)
roles +
All about Full Stack Web Development users?
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
Nice tutorial, thank you! It has helped me get ACL working on my new app. I am
— Chris Van Cleve experiencing one small issue though: Trying to use the auth:permission artisan
(https://chris.vanclevefa
command works for creating new permissions, but trying to use the –R or remove
mily.net)
May 14, 2017 option results in “The “–R” option does not exist.” or “Too many arguments,
(https://www.qcode.in/easy
-roles-and-permissions-in-
expected arguments “command” “name”. respectively. Any ideas why I can’t specify
laravel-5-4/#comment-26) remove?
/
— Satish Reddy
QCode (https://www.qcode.in/)
excellent tutorial, it showed me the way. i struck here, where in migrations when i
June 9, 2017
(https://www.qcode.in/easy
see migrations it can create model_has_roles and model_has_permissions tables.
All -roles-and-permissions-in-
about Full Stack Web Development
laravel-5-4/#comment-33)
But when i run the code i am getting errors like ‘base table or view not found. we
Home About
don’t have Contacttable. Please
tables like user_has_roles and user_has_permissions
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
suggest. thank you in advance. thank you
Home (http://www.qcode.in)
Its seems you forgot to ran the migrations, please try
About (https://www.qcode.in/about/)
— Saqueib running it but
June 9, 2017
(https://www.qcode
php artisan migrate
Contact (https://www.qcode.in/contact/)
.in/easy-roles-and-
permissions-in- or
laravel-5-
4/#comment-34) php artisan migrate:refresh
or if you have cloned code from repo you can run the php
migration.
Hey Saqueib,
— madsem
June 12, 2017 very nice tutorial! Thanks a lot, will use this for my new app.
(https://www.qcode.in/easy
-roles-and-permissions-in-
Quick question: As far as I can see, there is nothing prepared to make queries in a
laravel-5-4/#comment-36)
Controller based on user permissions.
For example on an edit view, include roles for admins, but not for normal users.
Just rely on @can(‘admin’) in Blade, or actually do two seperate Eloquent queries for
each user role to only include the data they are allowed to see?
Home (http://www.qcode.in)
got it, thanks 🙂
— madsem
About (https://www.qcode.in/about/)
I think I wasn’t 100% clear with my
June 12, 2017
(https://www.
qcode.in/eas
question.
Contact (https://www.qcode.in/contact/)
y-roles-and-
permissions- I meant: Would you even make
in-laravel-5-
4/#comment- Eloquent queries based on user roles,
38)
or just one query for all data a View
needs, and then only use
@can(‘permission’) in the Blade view
to include/exclude data, or would you
make multiple DB queries, one for
each role? Like what do you think is
best practice here 🙂
$user-
>syncPermissions($permissions);
}
“`
should be:
“`
… /
}
QCode (https://www.qcode.in/)
// handle permissions
All about Full Stack Web Development
$user-
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
>syncPermissions($permissions); (https://www.qcode.in/contact/
“`
Home (http://www.qcode.in)
otherwise permissions are not
correctly updated when you override
About (https://www.qcode.in/about/)
them on a per user basis.
Contact (https://www.qcode.in/contact/)
And in Handler.php you have
commented out the render() method,
which causes the auth check to throw
an error when a user does an
unauthorized action.
Great Tutorial, I am new in laravel and I am learning how to manage the roles and
— Jonathan Espinosa permissions situation, Can you help to understand how to add new permissions
June 17, 2017
(https://www.qcode.in/easy
and roles? and to martch it with the controllers or routes, I can understand that. I
-roles-and-permissions-in- hope you can help me. sorry for this noob cuestion.
laravel-5-4/#comment-40)
/
Now when you have got roles and permissions ready you
QCode (https://www.qcode.in/)
can add Authorizable trait on a any resource controller to
All about Full Stack Webprotect
Development
it via permissions.
Home (http://www.qcode.in)
use Authorizable;
…
About (https://www.qcode.in/about/)
I hope it helps you. If you have any question let me know
Contact (https://www.qcode.in/contact/)
http://pos.hello-sylhet.com/ (http://pos.hello-sylhet.com/)
Contact (https://www.qcode.in/contact/)
ode.in/e
asy-
roles-
and-
permissi
ons-in-
laravel-
5-
4/#com
ment-
55)
I am total newbie in laravel, I tried following this tutorial, when I run php artisan
— tahjid ashfaque db:seed, I am getting this error,
June 27, 2017
(https://www.qcode.in/easy
-roles-and-permissions-in-
[SymfonyComponentDebugExceptionFatalThrowableError]
laravel-5-4/#comment-49) Class ‘Permission’ not found
but my Permission model is de ned , please help.
Thank You
/
QCode (https://www.qcode.in/)
It seems a Namespace Issue, make sure you import the
— Mohd Permission Model, by default it will be App\ Permission.
All about Full Stack Web Development
Saqueib
Here is Permissions controller
June 28, 2017
Home(https://www.qcode About
https://github.com/saqueib/roles-permissions- Contact
(http://www.qcode.in)
.in/easy-roles-and- (https://www.qcode.in/about/) (https://www.qcode.in/contact/
permissions-in- laravel/blob/master/app/Permission.php
laravel-5-
(https://github.com/saqueib/roles-permissions-
4/#comment-51)
Home (http://www.qcode.in)
laravel/blob/master/app/Permission.php)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
How can i hide topnav menus.
— Shakir Bhatt
July 10, 2017
(https://www.qcode.in/easy
-roles-and-permissions-in- You can edit master app layout to hide the menu, you can
laravel-5-4/#comment-56)
— Saqueib nd it here https://github.com/saqueib/roles-permissions-
July 10, 2017
(https://www.qcode
laravel/blob/master/resources/views/layouts/app.blade.php#L29
.in/easy-roles-and- (https://github.com/saqueib/roles-permissions-
permissions-in-
laravel-5- laravel/blob/master/resources/views/layouts/app.blade.php#L29)
4/#comment-57)
{{trans(‘dashboard.security’)}}
— Shakir
Bhatt @can(‘view_roles’)
July 10, 2017
(https://www.
qcode.in/eas
y-roles-and- {{trans(‘dashboard.role_management’)}}
permissions-
in-laravel-5-
({{ route('roles.index') }})
4/#comment-
59)
/
@endcan
QCode (https://www.qcode.in/)
@can(‘view_users’)
All about Full Stack Web Development
Contact (https://www.qcode.in/contact/)
security on permission basis
Great tutorial, I have everything working until i get ‘This action is authorized’ for a
— ADEBOYE OLAITAN particular route which i have given permission to
MERCY
July 18, 2017
Am i missing something
(https://www.qcode.in/easy
-roles-and-permissions-in-
laravel-5-4/#comment-63)
Help please
/
QCode (https://www.qcode.in/)
Hi. Great tutorial, I’m still working through it but encountered an issue. The check
— RichLove here: if ($exception instanceof AuthorizationException) in Handler.php is returning
All about FullJuly
Stack Web Development
27, 2017
(https://www.qcode.in/easy
false when there is an auth error. When I dump $exception it looks like an instance
Home
-roles-and-permissions-in- About
of AuthorizationException Contact
so not sure why the check return false. I noticed also this
(http://www.qcode.in)
laravel-5-4/#comment-69) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
line of code is commented out in the project github repo.
https://github.com/saqueib/roles-permissions-
Home (http://www.qcode.in)
laravel/blob/master/app/Exceptions/Handler.php#L48
(https://github.com/saqueib/roles-permissions-
About (https://www.qcode.in/about/)
laravel/blob/master/app/Exceptions/Handler.php#L48)
Contact (https://www.qcode.in/contact/)
— I think
Saq PHPStorm
ueib
is very
July
31, helpful, /
2017
you can
QCode (https://www.qcode.in/)
(http
see my s://w
ww.
All about Full Stack Web Development qcod
earlier
e.in/ post on
Home About easy Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
- this (https://www.qcode.in/contact/
roles
-
http://www.qcod
and- editor-use-
Home (http://www.qcode.in) per
miss web-
ions-
development/
in-
About (https://www.qcode.in/about/)
larav (http://www.qcod
el-5-
4/#c editor-use-
Contact (https://www.qcode.in/contact/)
om
web-
men
t-79) development/)
— Great,
Rich thanks.
Lov
Will read
e
July your article
31,
2017
(http
s://w
ww.
qcod
e.in/
easy
-
roles
-
and-
per
miss
ions-
in-
larav
el-5-
4/#c
om
men
t-80)
/
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Fantastic tutorial and base ACL, thank you!
Home About Contact
— RichLove
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
July 27, 2017
(https://www.qcode.in/easy
-roles-and-permissions-in-
laravel-5-4/#comment-73)
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Hi Sequeib,
— Nabiullah Khan Thanks for wonderful tutorial, please help me.
Contact (https://www.qcode.in/contact/)
July 30, 2017
(https://www.qcode.in/easy
-roles-and-permissions-in-
when I use “php artisan migrate” so it gives error
laravel-5-4/#comment-76)
[IlluminateDatabaseQueryException]
icode_ci)
[PDOException]
Its seems you are not getting the table name from con g
— Saqueib le, please publish the vendor con g using this.
July 31, 2017
(https://www.qcode
.in/easy-roles-and-
php artisan vendor:publish --
permissions-in-
laravel-5- provider="SpatiePermissionPermissionServiceProvider"
4/#comment-78)
--tag="config"
/
QCode (https://www.qcode.in/)
I have successfully con gure the above example and worked ne for laravel
— somenet77 resource controller. But when i have added custom method in the controller the
All about Full Stack Web Development
August 10, 2017
(https://www.qcode.in/easy
403 error doesn’t work no protection over such url. But when i have added the such
Home
-roles-and-permissions-in- About
method in Contact
Abilities array in Authorizable traits it worked ne. But my question is, it
(http://www.qcode.in)
laravel-5-4/#comment-83) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
is not good to added every custom method in the Abilities array. So what is the
solution.
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
You don’t need to add in abilities array, that array is used
— Saqueib if you want to change naming convention of routes
August 11, 2017
Contact (https://www.qcode.in/contact/)
(https://www.qcode
altogether, by default its set for resource controller
.in/easy-roles-and- naming convention.
permissions-in-
laravel-5-
4/#comment-84) For any custom method authorization you should use
$this->authorize('your_custom_permission');
...
Its simple,
— AuthorizationException
Saquei
Handler checks if its an
b
Unauthorized
/
August
Exception it returns
QCode (https://www.qcode.in/)
12, 2017
redirect to home with
(https://
www.qc
All about Full Stack Web Development
ode.in/e
a ash mag, and if its
asy- an ajax call it will
Home roles- About Contact
(http://www.qcode.in)
and- (https://www.qcode.in/about/)
return unauthorize (https://www.qcode.in/contact/
permissi
ons-in-
msg as json. thats all
laravel- its doing
Home (http://www.qcode.in)
4/#com
5-
ment-
91)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
(1/1) HttpException
— TZY This action is unauthorized.
August 11, 2017
(https://www.qcode.in/easy
-roles-and-permissions-in-
May i know how to solve this error?
laravel-5-4/#comment-85)
What should i do if i want user to be able to access the ACL?
/
If you need any other help let me know with some code
QCode (https://www.qcode.in/)
where you are getting this unauthorized exception.
All about Full Stack Web Development
Home About
Actually i am recovering a old project
Contact
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
— TZY that use laravel-permission package,
August 11,
2017
now i am able to access the role and
Home (http://www.qcode.in)
(https://www. user by commenting the Authorizable
qcode.in/eas
y-roles-and- trait. Even if i login as admin i am not
About (https://www.qcode.in/about/)
permissions-
able to make changes in the role and
in-laravel-5-
4/#comment- user view.
Contact (https://www.qcode.in/contact/)
88)
Hi there, when I run the php artisan db:seed, everything works normal till the:
— Ivan “Enter roles in comma separate format. [Admin,User]:”
August 11, 2017
(https://www.qcode.in/easy
-roles-and-permissions-in-
when I entered the roles, it show something like this:
laravel-5-4/#comment-89) [SymfonyComponentDebugExceptionFatalThrowableError]
Parse error: syntax error, unexpected ‘;’, expecting function (T_FUNCTION)
/
I rechecked the DatabaseSeeder.php and everything look ne, but maybe I miss
QCode (https://www.qcode.in/)
something
All about Full Stack Web Development
and btw, nice tutorial, and thank you.
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
https://github.com/Majunko/Test (https://github.com/Majunko/Test)
Route::resource('usuarios', 'UserController'); //
Users
({{ route('usuarios.index') }})
@endcan
# resources/views/user/index.blade.php line:12,43
Create ({{ route('usuarios.create') }})
/
@include('shared._actions', [
QCode (https://www.qcode.in/)
'entity' => 'usuarios',
All about Full Stack Web'id'
Development
=> $item->id
])
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
This will show you the users list, but you will be needed to
update it everywhere, in Form action and in other views
Home (http://www.qcode.in)
also.
Greetings from Colombia. I try to implement step by step this tutorial, but when I
— Pedro Araujo apply the command: “php artisan db:seed” I get the errors as imagen shows. Any
(http://www.ingpedroar
idea?
aujo.com)
August 28, 2017
(https://www.qcode.in/easy https://uploads.disquscdn.com/images/6a09b3193e4b28a99a0b3490f5519324aade44713
-roles-and-permissions-in-
(https://uploads.disquscdn.com/images/6a09b3193e4b28a99a0b3490f5519324aade4471
laravel-5-4/#comment-107)
Hiiiii
— arun saw this is a very good tutorial
August 28, 2017
(https://www.qcode.in/easy
but i can’t undertood
-roles-and-permissions-in- where i add Authorizable Trait
laravel-5-4/#comment-108)
Please guide me.
Thanks
/
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Im trying to creat post, but i found error when i click save. any idea…what it causes?
Home (http://www.qcode.in)
im creating new role for other user, but when i give access for editing and deleting
About (https://www.qcode.in/about/)
— Sanchez post in role
August 29, 2017
Contact (https://www.qcode.in/contact/)
https://uploads.disquscdn.com/images/ca9fa5241faf8d055d69a9fbdaed193053b6506a26
(https://www.qcode.in/easy
-roles-and-permissions-in- (https://uploads.disquscdn.com/images/ca9fa5241faf8d055d69a9fbdaed193053b6506a2
laravel-5-4/#comment-114)
, the action icon wont show. any idea what it cause?
/
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Contact (https://www.qcode.in/contact/)
Hi, I made extra column for the role table, called role_desc and it already work
— Ivan when I add new role with its description. It also already displayed at the Role page.
August 29, 2017
(https://www.qcode.in/easy
But, when I try to edit user, it gave an error, unde ned variable “role”. So my
-roles-and-permissions-in- question is, how to make it work at user edit page?
laravel-5-4/#comment-116)
for example, “Your Current role is Admin. (Role Description: …).
At _permissions.blade.php, I used “Role Description: {{ $role->role_desc }}” to show
role description.
Thank you.
Thats strange If you can, just create repo and push your
— Saqueib code I can see, must be something related to passing
August 29, 2017
(https://www.qcode
$role data to view
.in/easy-roles-and-
permissions-in-
laravel-5-
4/#comment-117) Thx for your time, the code exactly the
— Ivan same as the tutorial provided, I only
August 29,
2017
add the “Role Description: {{ $role-
(https://www. >role_desc }}” right above
qcode.in/eas
y-roles-and- “@foreach($permissions as $perm)”at
permissions-
in-laravel-5-
_permissions.blade.php ( rst image)
4/#comment- and the second image for the
118)
RoleController which I change at little
at store method.
https://uploads.disquscdn.com/images/4bc37
/
(https://uploads.disquscdn.com/images/4bc3
QCode (https://www.qcode.in/)
https://uploads.disquscdn.com/images/a1390
All about Full Stack Web Development
(https://uploads.disquscdn.com/images/a139
— I got it
Ivan now, thx
Aug
ust for your
29,
time.
2017
(http
s://w
ww.
qcod
e.in/
easy
-
roles
-
and-
per
miss
/
ions-
QCode (https://www.qcode.in/)
in-
larav
el-5-
All about Full Stack Web Development
4/#c
om
Home About
men Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
t- (https://www.qcode.in/contact/
120)
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
When using custom guard like admin. And put the Authorizable trait in controller it
— somenet77 doesn’t work. i get 403 exception, how to x this one.
August 30, 2017
(https://www.qcode.in/easy
-roles-and-permissions-in-
laravel-5-4/#comment-123)
you should try to set your guard default if possible
— Saqueib (config('auth.default.guard') or you can check this
August 31, 2017
(https://www.qcode to see how you can use multiple guards
.in/easy-roles-and-
https://github.com/spatie/laravel-permission#using-
permissions-in-
laravel-5- multiple-guards (https://github.com/spatie/laravel-
4/#comment-124)
permission#using-multiple-guards)
QCode (https://www.qcode.in/)
asy-
roles-
and-
All about Full Stack Web Development permissi
ons-in-
Home About laravel- Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
5- (https://www.qcode.in/contact/
4/#com
ment-
233)
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
Hi,
— Colin Stewart Thanks for a great tutorial.
September 6, 2017
(https://www.qcode.in/easy
When I run the command “php artisan db:seed” I get this error:
-roles-and-permissions-in- [InvalidArgumentException]
laravel-5-4/#comment-130)
Unable to locate factory with name [default] [AppPost].
Any idea why?
QCode (https://www.qcode.in/)
roles-
and-
permissi
All about Full Stack Web Development
ons-in-
laravel-
Home 5- About Contact
(http://www.qcode.in)
4/#com (https://www.qcode.in/about/) (https://www.qcode.in/contact/
ment-
184)
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
How de ne a factory?
— Cleber
Martins
October 25,
2017
(https://www.
qcode.in/eas
y-roles-and-
permissions-
in-laravel-5-
4/#comment-
183)
Hi,
— Colin Stewart I don’t get the ash messages appearing when I do something, like ash(‘Role
September 7, 2017
(https://www.qcode.in/easy
Added’);
-roles-and-permissions-in- What am I missing?
laravel-5-4/#comment-133)
/
Also include the JS part to show it
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Home About
$(function () { Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
// flash auto hide
(https://www.qcode.in/contact/
$('#flash-msg .alert').not('.alert-danger,
.alert-important').delay(6000).slideUp(500);
Home (http://www.qcode.in)
})
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
Check here for layout https://github.com/saqueib/roles-
permissions-
laravel/blob/master/resources/views/layouts/app.blade.php#L114
(https://github.com/saqueib/roles-permissions-
laravel/blob/master/resources/views/layouts/app.blade.php#L114
Many thanks.
— Colin
Stewart
September 7,
2017
(https://www.
qcode.in/eas
y-roles-and-
permissions-
in-laravel-5-
4/#comment-
135)
Hi again,
— Colin Stewart If I visit an invalid URL like /users/10/edit (when user 10 does not exist), I get the
September 7, 2017
(https://www.qcode.in/easy
attached error rather than the exception handling, any ideas?
-roles-and-permissions-in- https://uploads.disquscdn.com/images/f785476fa84612935ce34a760a302ec1b611fcf6a7
laravel-5-4/#comment-136)
(https://uploads.disquscdn.com/images/f785476fa84612935ce34a760a302ec1b611fcf6a7
/
— Saqueib
QCode (https://www.qcode.in/)
Maybe your logged in user dont have permission to edit a
September 8, 2017
(https://www.qcode
.in/easy-roles-and- user, also you should change UserController@edit to
All about Full Stack Web Development
permissions-in-
use User::findOrFail($id) instead $user =
laravel-5-
Home 4/#comment-137) About which will give 404 if user doesn’t Contact
User::find($id);
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
exists, https://github.com/saqueib/roles-permissions-
laravel/blob/master/app/Http/Controllers/UserController.php#L9
Home (http://www.qcode.in)
(https://github.com/saqueib/roles-permissions-
laravel/blob/master/app/Http/Controllers/UserController.php#L9
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
I have the code included you speci ed
— Colin and the user can edit users.
Stewart
If the user has permissions to edit a
September 8,
2017 user and I say edit user 3, the user
(https://www.
qcode.in/eas account edit appears. If I then change
y-roles-and-
the URL in the browser to a user that
permissions-
in-laravel-5- doesn’t exist (like user 31) then I get
4/#comment-
138) an error saying:
Trying to get property of non-object
(View:
/resources/views/user/edit.blade.php),
shouldn’t that get caught by the
exception handler?
I have bumped into an issue, after adding other permissions manually, i couldn’t
— Ayman Ishimwe manage to make them also default to the Admin role, and it also seems like i can’t
September 11, 2017
(https://www.qcode.in/easy
check(tick) them. Can someone help me out!
/
-roles-and-permissions-in-
Regards!
QCode (https://www.qcode.in/)
laravel-5-4/#comment-140)
Contact (https://www.qcode.in/contact/)
/*
|
—————————————————————
| Application Debug Mode
|
—————————————————————
|
| When your application is in debug
mode, detailed error messages with
| stack traces will be shown on every
error that occurs within your
| application. If disabled, a simple
generic error page is shown.
|
*/
/*
|
—————————————————————
| Application URL
|
—————————————————————
|
/
| This URL is used by the console to
QCode (https://www.qcode.in/)
properly generate URLs when using
All about Full Stack Web Development
| the Artisan command line tool. You
should set this to the root of
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
| your application so that it is used (https://www.qcode.in/contact/
when running Artisan tasks.
|
Home (http://www.qcode.in)*/
About (https://www.qcode.in/about/)
‘url’ => env(‘APP_URL’,
‘http://localhost’),
Contact (https://www.qcode.in/contact/)
/*
|
—————————————————————
| Application Timezone
|
—————————————————————
|
| Here you may specify the default
timezone for your application, which
| will be used by the PHP date and
date-time functions. We have gone
| ahead and set this to a sensible
default for you out of the box.
|
*/
/*
|
—————————————————————
| Application Locale Con guration
|
—————————————————————
|
| The application locale determines
the default locale that will be used
| by the translation service provider.
You are free to set this value
/
| to any of the locales which will be
QCode (https://www.qcode.in/)
supported by the application.
All about Full Stack Web Development
|
*/
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
‘locale’ => ‘en’,
/*
Home (http://www.qcode.in)
|
—————————————————————
About (https://www.qcode.in/about/)
| Application Fallback Locale
|
Contact (https://www.qcode.in/contact/)
—————————————————————
|
| The fallback locale determines the
locale to use when the current one
| is not available. You may change the
value to correspond to any of
| the language folders that are
provided through your application.
|
*/
/*
|
—————————————————————
| Encryption Key
|
—————————————————————
|
| This key is used by the Illuminate
encrypter service and should be set
| to a random, 32 character string,
otherwise these encrypted strings
| will not be safe. Please do this
before deploying an application!
|
*/
/
‘key’ => env(‘APP_KEY’),
QCode (https://www.qcode.in/)
‘cipher’ => ‘AES-256-CBC’,
All about Full Stack Web Development
/*
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
| (https://www.qcode.in/contact/
—————————————————————
| Logging Con guration
Home (http://www.qcode.in)
|
—————————————————————
About (https://www.qcode.in/about/)
|
| Here you may con gure the log
Contact (https://www.qcode.in/contact/)
settings for your application. Out of
| the box, Laravel uses the Monolog
PHP logging library. This gives
| you a variety of powerful log
handlers / formatters to utilize.
|
| Available Settings: “single”, “daily”,
“syslog”, “errorlog”
|
*/
/*
|
—————————————————————
| Autoloaded Service Providers
|
—————————————————————
|
| The service providers listed here will
be automatically loaded on the
| request to your application. Feel free
to add your own services to
| this array to grant expanded
/
functionality to your applications.
QCode (https://www.qcode.in/)
|
All about Full Stack Web Development
*/
Home About
‘providers’ => [ Contact
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
/*
* Laravel Framework Service
Home (http://www.qcode.in)
Providers…
*/
About (https://www.qcode.in/about/)
IlluminateAuthAuthServiceProvider::class,
IlluminateBroadcastingBroadcastServiceProv
Contact (https://www.qcode.in/contact/)
IlluminateBusBusServiceProvider::class,
IlluminateCacheCacheServiceProvider::class,
IlluminateFoundationProvidersConsoleSuppo
IlluminateCookieCookieServiceProvider::class
IlluminateDatabaseDatabaseServiceProvider:
IlluminateEncryptionEncryptionServiceProvid
IlluminateFilesystemFilesystemServiceProvide
IlluminateFoundationProvidersFoundationSe
IlluminateHashingHashServiceProvider::class
IlluminateMailMailServiceProvider::class,
IlluminateNoti cationsNoti cationServicePro
IlluminatePaginationPaginationServiceProvid
IlluminatePipelinePipelineServiceProvider::cla
IlluminateQueueQueueServiceProvider::class
IlluminateRedisRedisServiceProvider::class,
IlluminateAuthPasswordsPasswordResetServ
IlluminateSessionSessionServiceProvider::clas
IlluminateTranslationTranslationServiceProvi
IlluminateValidationValidationServiceProvide
IlluminateViewViewServiceProvider::class,
SpatiePermissionPermissionServiceProvider::
LaracastsFlashFlashServiceProvider::class,
CollectiveHtmlHtmlServiceProvider::class,
/*
* Package Service Providers…
*/
LaravelTinkerTinkerServiceProvider::class,
/
/*
QCode (https://www.qcode.in/)
* Application Service Providers…
All about Full Stack Web Development
*/
AppProvidersAppServiceProvider::class,
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
AppProvidersAuthServiceProvider::class, (https://www.qcode.in/contact/
//
AppProvidersBroadcastServiceProvider::class
Home (http://www.qcode.in)AppProvidersEventServiceProvider::class,
AppProvidersRouteServiceProvider::class,
About (https://www.qcode.in/about/)
],
Contact (https://www.qcode.in/contact/)
/*
|
—————————————————————
| Class Aliases
|
—————————————————————
|
| This array of class aliases will be
registered when this application
| is started. However, feel free to
register as many as you wish as
| the aliases are “lazy” loaded so they
don’t hinder performance.
|
*/
‘aliases’ => [
‘App’ =>
IlluminateSupportFacadesApp::class,
‘Artisan’ =>
IlluminateSupportFacadesArtisan::class,
‘Auth’ =>
IlluminateSupportFacadesAuth::class,
‘Blade’ =>
IlluminateSupportFacadesBlade::class,
‘Broadcast’ =>
IlluminateSupportFacadesBroadcast::class,
‘Bus’ =>
/
IlluminateSupportFacadesBus::class,
QCode (https://www.qcode.in/)
‘Cache’ =>
All about Full Stack Web Development
IlluminateSupportFacadesCache::class,
‘Con g’ =>
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
IlluminateSupportFacadesCon g::class, (https://www.qcode.in/contact/
‘Cookie’ =>
IlluminateSupportFacadesCookie::class,
Home (http://www.qcode.in)‘Crypt’ =>
IlluminateSupportFacadesCrypt::class,
About (https://www.qcode.in/about/)
‘DB’ =>
IlluminateSupportFacadesDB::class,
Contact (https://www.qcode.in/contact/)
‘Eloquent’ =>
IlluminateDatabaseEloquentModel::class,
‘Event’ =>
IlluminateSupportFacadesEvent::class,
‘File’ =>
IlluminateSupportFacadesFile::class,
‘Gate’ =>
IlluminateSupportFacadesGate::class,
‘Hash’ =>
IlluminateSupportFacadesHash::class,
‘Lang’ =>
IlluminateSupportFacadesLang::class,
‘Log’ =>
IlluminateSupportFacadesLog::class,
‘Mail’ =>
IlluminateSupportFacadesMail::class,
‘Noti cation’ =>
IlluminateSupportFacadesNoti cation::class,
‘Password’ =>
IlluminateSupportFacadesPassword::class,
‘Queue’ =>
IlluminateSupportFacadesQueue::class,
‘Redirect’ =>
IlluminateSupportFacadesRedirect::class,
‘Redis’ =>
IlluminateSupportFacadesRedis::class,
‘Request’ =>
IlluminateSupportFacadesRequest::class,
/
‘Response’ =>
QCode (https://www.qcode.in/)
IlluminateSupportFacadesResponse::class,
All about Full Stack Web Development
‘Route’ =>
IlluminateSupportFacadesRoute::class,
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
‘Schema’ => (https://www.qcode.in/contact/
IlluminateSupportFacadesSchema::class,
‘Session’ =>
Home (http://www.qcode.in)IlluminateSupportFacadesSession::class,
‘Storage’ =>
About (https://www.qcode.in/about/)
IlluminateSupportFacadesStorage::class,
‘URL’ =>
Contact (https://www.qcode.in/contact/)
IlluminateSupportFacadesURL::class,
‘Validator’ =>
IlluminateSupportFacadesValidator::class,
‘View’ =>
IlluminateSupportFacadesView::class,
‘Form’ =>
CollectiveHtmlFormFacade::class,
‘Html’ =>
CollectiveHtmlHtmlFacade::class,
],
];
share your
— composer.json le
Saquei
b
Septem
ber 15,
— Thanks for
2017
(https:// Gun reply.
www.qc jan
ode.in/e kindly
Sept
asy- emb check
roles- er
and- 15, composser.json
permissi 2017
ons-in-
{
(http
laravel- s://w “name”:
5- ww.
4/#com qcod “laravel/laravel”,
ment- e.in/
146)
“description”:
easy
- “The
roles
/
-
Laravel
QCode (https://www.qcode.in/)
and-
Framework.”, per
miss
All about Full Stack Web Developmentions- “keywords”:
in- [“framework”,
Home Aboutlarav Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
el-5- “laravel”], (https://www.qcode.in/contact/
4/#c
om
“license”:
men “MIT”,
Home (http://www.qcode.in) t-
148) “type”:
“project”,
About (https://www.qcode.in/about/)
“require”: {
“php”:
Contact (https://www.qcode.in/contact/)
“>=5.6.4”,
“laravel/framewo
“5.4.*”,
“laravel/tinker”:
“~1.0”,
“spatie/laravel-
permission”:
“^2.1”,
“laracasts/ ash”:
“^3.0”,
“laravelcollective/
“^5.3.0”,
},
“require-
dev”: {
“fzaninotto/faker
“~1.4”,
“mockery/mocke
“0.9.*”,
“phpunit/phpunit
“~5.7”
},
“autoload”:
{
“classmap”:
[
“database”
],
/
“psr-4”: {
QCode (https://www.qcode.in/)
“App\”:
All about Full Stack Web Development “app/”
}
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
}, (https://www.qcode.in/contact/
“autoload-
dev”: {
Home (http://www.qcode.in) “psr-4”: {
“Tests\”:
About (https://www.qcode.in/about/)
“tests/”
}
Contact (https://www.qcode.in/contact/)
},
“scripts”: {
“post-root-
package-
install”: [
“php -r
“ le_exists(‘.env’)
||
copy(‘.env.examp
‘.env’);””
],
“post-
create-
project-
cmd”: [
“php
artisan
key:generate”
],
“post-
install-
cmd”: [
“Illuminate\Foun
“php
artisan
optimize”
],
“post-
/
update-
QCode (https://www.qcode.in/)
cmd”: [
All about Full Stack Web Development “Illuminate\Foun
“php
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
artisan (https://www.qcode.in/contact/
optimize”
]
Home (http://www.qcode.in) },
“con g”: {
About (https://www.qcode.in/about/)
“preferred-
install”:
Contact (https://www.qcode.in/contact/)
“dist”,
“sort-
packages”:
true,
“optimize-
autoloader”:
true
}
}
— run
San composer
tut
update
Ken
dur
Dece
mbe
r 7,
2017
(http
s://w
ww.
qcod
e.in/
easy
-
roles
-
and-
per
miss
ions-
in-
larav
/
el-5-
QCode (https://www.qcode.in/)
4/#c
om
men
All about Full Stack Web Development
t-
213)
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
‘providers’ => [
Contact (https://www.qcode.in/contact/)
— Gunjan
September /*
15, 2017
(https://www.
* Laravel Framework Service
qcode.in/eas Providers…
y-roles-and-
permissions- */
in-laravel-5-
IlluminateAuthAuthServiceProvider::class,
4/#comment-
145) IlluminateBroadcastingBroadcastServiceProv
IlluminateBusBusServiceProvider::class,
IlluminateCacheCacheServiceProvider::class,
IlluminateFoundationProvidersConsoleSuppo
IlluminateCookieCookieServiceProvider::class
IlluminateDatabaseDatabaseServiceProvider:
IlluminateEncryptionEncryptionServiceProvid
IlluminateFilesystemFilesystemServiceProvide
IlluminateFoundationProvidersFoundationSe
IlluminateHashingHashServiceProvider::class
IlluminateMailMailServiceProvider::class,
IlluminateNoti cationsNoti cationServicePro
IlluminatePaginationPaginationServiceProvid
IlluminatePipelinePipelineServiceProvider::cla
IlluminateQueueQueueServiceProvider::class
IlluminateRedisRedisServiceProvider::class,
IlluminateAuthPasswordsPasswordResetServ
IlluminateSessionSessionServiceProvider::clas
IlluminateTranslationTranslationServiceProvid
IlluminateValidationValidationServiceProvide
IlluminateViewViewServiceProvider::class,
/
SpatiePermissionPermissionServiceProvider::
QCode (https://www.qcode.in/)
LaracastsFlashFlashServiceProvider::class,
All about Full Stack Web CollectiveHtmlHtmlServiceProvider::class,
Development
Home (http://www.qcode.in)
LaravelTinkerTinkerServiceProvider::class,
/*
About (https://www.qcode.in/about/)
* Application Service Providers…
*/
Contact (https://www.qcode.in/contact/)
AppProvidersAppServiceProvider::class,
AppProvidersAuthServiceProvider::class,
//
AppProvidersBroadcastServiceProvider::class
AppProvidersEventServiceProvider::class,
AppProvidersRouteServiceProvider::class,
],
/*
|
—————————————————————
| Class Aliases
|
—————————————————————
|
| This array of class aliases will be
registered when this application
| is started. However, feel free to
register as many as you wish as
| the aliases are “lazy” loaded so they
don’t hinder performance.
|
*/
‘aliases’ => [
‘App’ =>
IlluminateSupportFacadesApp::class,
‘Artisan’ =>
/
IlluminateSupportFacadesArtisan::class,
QCode (https://www.qcode.in/)
‘Auth’ =>
All about Full Stack Web IlluminateSupportFacadesAuth::class,
Development
‘Blade’ =>
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
IlluminateSupportFacadesBlade::class, (https://www.qcode.in/contact/
‘Broadcast’ =>
IlluminateSupportFacadesBroadcast::class,
Home (http://www.qcode.in)
‘Bus’ =>
IlluminateSupportFacadesBus::class,
About (https://www.qcode.in/about/)
‘Cache’ =>
IlluminateSupportFacadesCache::class,
Contact (https://www.qcode.in/contact/)
‘Con g’ =>
IlluminateSupportFacadesCon g::class,
‘Cookie’ =>
IlluminateSupportFacadesCookie::class,
‘Crypt’ =>
IlluminateSupportFacadesCrypt::class,
‘DB’ =>
IlluminateSupportFacadesDB::class,
‘Eloquent’ =>
IlluminateDatabaseEloquentModel::class,
‘Event’ =>
IlluminateSupportFacadesEvent::class,
‘File’ =>
IlluminateSupportFacadesFile::class,
‘Gate’ =>
IlluminateSupportFacadesGate::class,
‘Hash’ =>
IlluminateSupportFacadesHash::class,
‘Lang’ =>
IlluminateSupportFacadesLang::class,
‘Log’ =>
IlluminateSupportFacadesLog::class,
‘Mail’ =>
IlluminateSupportFacadesMail::class,
‘Noti cation’ =>
IlluminateSupportFacadesNoti cation::class,
‘Password’ =>
IlluminateSupportFacadesPassword::class,
/
‘Queue’ =>
QCode (https://www.qcode.in/)
IlluminateSupportFacadesQueue::class,
All about Full Stack Web ‘Redirect’
Development
=>
IlluminateSupportFacadesRedirect::class,
Home About Contact
(http://www.qcode.in)
‘Redis’ => (https://www.qcode.in/about/) (https://www.qcode.in/contact/
IlluminateSupportFacadesRedis::class,
‘Request’ =>
Home (http://www.qcode.in)
IlluminateSupportFacadesRequest::class,
‘Response’ =>
About (https://www.qcode.in/about/)
IlluminateSupportFacadesResponse::class,
‘Route’ =>
Contact (https://www.qcode.in/contact/)
IlluminateSupportFacadesRoute::class,
‘Schema’ =>
IlluminateSupportFacadesSchema::class,
‘Session’ =>
IlluminateSupportFacadesSession::class,
‘Storage’ =>
IlluminateSupportFacadesStorage::class,
‘URL’ =>
IlluminateSupportFacadesURL::class,
‘Validator’ =>
IlluminateSupportFacadesValidator::class,
‘View’ =>
IlluminateSupportFacadesView::class,
‘Form’ =>
CollectiveHtmlFormFacade::class,
‘Html’ =>
CollectiveHtmlHtmlFacade::class,
],
];
— Samuel
/
September 16, 2017
QCode (https://www.qcode.in/)
(https://www.qcode.in/easy
Thanks for this write up, you saved me many hours of work. I’m having a little
-roles-and-permissions-in-
laravel-5-4/#comment-150) problem with the Authorizable Trait tho. right now, when I try to access a controller
All about Full Stack Web Development
that uses the trait (let’s say ExampleController), I get “Unde ned method “…
Home About
Controllers\ExampleController::authorize”. Contact
Please kindly support.
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
AuthorizesRequests trait.
Sir, do you have a tutorial base on native laravel auth? Can you make it multiple role
— Junie Negentien permission using the native way? Packages has its own disadvantages I’m looking
October 3, 2017
(https://www.qcode.in/easy
into some native way. There are some but it doesn’t t on what Im looking for. Btw,
-roles-and-permissions-in- you have the better explaination based on spatie . Thanks for this
laravel-5-4/#comment-173)
/
— Lambert
QCode (https://www.qcode.in/)
Great tutorials. Wouldn’t it be better to use a middleware ? You would expect to
October 27, 2017
(https://www.qcode.in/easy
receive a 403 but if the data doesn’t passe validation you will get a 422 instead. I
All -roles-and-permissions-in-
about Full Stack Web Development
laravel-5-4/#comment-185)
made a quick gist based on your code.
Home About
https://gist.github.com/lamberttraccard/c0ab9c1 Contact
7b52bd4eb9d8fa188c4470c
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
(https://gist.github.com/lamberttraccard/c0ab9c1 7b52bd4eb9d8fa188c4470c)
Home (http://www.qcode.in)
Thats great idea, there is always more than one way to
About (https://www.qcode.in/about/)
— Saqueib solve a problem. Thanks for sharing your gist
October 27, 2017
(https://www.qcode
Contact (https://www.qcode.in/contact/)
.in/easy-roles-and-
permissions-in-
laravel-5-
4/#comment-186)
Hi,
— Ajaxiome One thing i can’t understand is in the Trait Authorizable
October 31, 2017
(https://www.qcode.in/easy
when we call $this->authorize($ability);
-roles-and-permissions-in- then we call the Laravel’s permission,and not the spatie one’s
laravel-5-4/#comment-187)
Then for every route i get an Unauthorized Exception, because the $ability is
unknow from Laravel core, just known by Spatie’s Tables
Thx
Its strange, please try with other name also php artisan
— Saqueib auth:permission appears
November 2, 2017
(https://www.qcode You can seed the data which will create admin user. php
.in/easy-roles-and- /
permissions-in-
artisan db:seed
QCode (https://www.qcode.in/)
laravel-5-
4/#comment-189)
[IlluminateDatabaseQueryException]
/
SQLSTATE[22P02]: Invalid text
QCode (https://www.qcode.in/)
representation: 7 ERROR: invalid input
All about Full Stack Web Development syntax for integer: “b2038760-bf9e-
11e7-a022-6b5e6a138514” (SQL: insert
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/)
into “model_has_roles” (“model_id”,(https://www.qcode.in/contact/
“model_type
About (https://www.qcode.in/about/)
1))
[PDOException]
“model_has_perm
foreign key
(“permission_id”)
references
“permissions”
(“id”) on
delete
cascade)
/
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Amazing tutorial, I have some problems though. First, when a user is not authorized
Home — zietbukuel to see access
Abouta resource, I get this error: Contact
(http://www.qcode.in)
November 6, 2017 (https://www.qcode.in/about/) (https://www.qcode.in/contact/
(https://www.qcode.in/easy
-roles-and-permissions-in-
Symfony Component HttpKernel Exception AccessDeniedHttpException
laravel-5-4/#comment-195) This action is unauthorized.
Home (http://www.qcode.in)
It seems that the Exception handler isn’t doing anything at all, I should be
About (https://www.qcode.in/about/)
redirected with a ash message, right?
Second issue is that when I try to create a new user, I get this error:
Contact (https://www.qcode.in/contact/)
Symfony Component HttpKernel Exception MethodNotAllowedHttpException
No message
Please let me know if you want me to share my code with you. Thanks a lot.
@can(‘edit_users’, ‘delete_users’)
@include(‘shared._actions’, [
‘entity’ => ‘users’,
‘id’ => $item->id
])
@endcan
Home (http://www.qcode.in)
^C
About (https://www.qcode.in/about/)
— dinesh C:UsersDineshDownloadsNew folder (2)roles-permissions-laravel-master>php
November 8, 2017
artisan db:seed
Contact (https://www.qcode.in/contact/)
(https://www.qcode.in/easy
-roles-and-permissions-in-
laravel-5-4/#comment-197) Do you wish to refresh migration before seeding, it will clear all old data ? (yes/no)
[no]:
> yes
Create Roles for user, default is admin and user? [y|N] (yes/no) [yes]:
>
/
QCode (https://www.qcode.in/)
how to check box permission saved, please help me
— dinesh
All aboutNovember
Full Stack Web Development
8, 2017
(https://www.qcode.in/easy
Home
-roles-and-permissions-in- About Contact
(http://www.qcode.in)
laravel-5-4/#comment-198) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
Home (http://www.qcode.in)
got the output. awesome tutorial thanks and please update more di erent roles
— dinesh and permission based on model
November 8, 2017
About (https://www.qcode.in/about/)
(https://www.qcode.in/easy
-roles-and-permissions-in-
laravel-5-4/#comment-199)
Contact (https://www.qcode.in/contact/)
Nice tutorial
— ELHADI
November 21, 2017
(https://www.qcode.in/easy
-roles-and-permissions-in-
laravel-5-4/#comment-212)
/
QCode (https://www.qcode.in/)
Call to unde ned method IlluminateDatabaseQueryBuilder::defaultPermissions()
— Mohammed naseer I have error when I run db:seed, what is the prolem?
All about Full Stack Web Development
January 1, 2018
(https://www.qcode.in/easy
Thanks….
Home
-roles-and-permissions-in- About Contact
(http://www.qcode.in)
laravel-5-4/#comment-224) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
It looks you haven’t imported the App /Permission Model,
— Saqueib it’s currently using packages permission model which
Home (http://www.qcode.in)
January 1, 2018
(https://www.qcode
don’t have defaultPermissions method
.in/easy-roles-and-
About (https://www.qcode.in/about/)
permissions-in-
laravel-5-
4/#comment-225)
Contact (https://www.qcode.in/contact/)
if using table admin do not use table user what is it possible? if you can what to
— Irfan Abdurrasyid change in the settings?
January 3, 2018
(https://www.qcode.in/easy
-roles-and-permissions-in-
laravel-5-4/#comment-229)
Sorry I didn’t get your question?
— Saqueib
January 3, 2018 If you mean to use admin table to store users instead of
(https://www.qcode
.in/easy-roles-and-
users table you can do it by changing the App/User class
permissions-in- property protected $table = admins’;
laravel-5-
4/#comment-230)
Let me know if you need help. You can check out Eloquent
naming convention here
https://laravel.com/docs/5.5/eloquent#eloquent-model-
conventions
(https://laravel.com/docs/5.5/eloquent#eloquent-model-
conventions)
/
4/#comment-
QCode (https://www.qcode.in/)
231)
help me : authorize($ability) not wok ng if use guard admin. on Gate error message
— Irfan Abdurrasyid array:4 [▼
January 4, 2018
(https://www.qcode.in/easy
“ability” => “view_order”
-roles-and-permissions-in- “result” => false
laravel-5-4/#comment-234)
“user” => 1
“arguments” => “[]”
]
i use guard web for customer (use table users) and guard admin for administrator
(use table admins). why result in gate always false.
[SymfonyComponentConsoleExceptionCommandNotFoundException]
— Falak naz Command “make:model” is not de ned.
January 10, 2018
(https://www.qcode.in/easy
Did you mean one of these?
-roles-and-permissions-in- make:seeder
laravel-5-4/#comment-241)
make:migration
/
QCode (https://www.qcode.in/)
Run php artisan make:model Post -mr
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Hey Saqueib, very nice tutorial! It works very well!
Contact (https://www.qcode.in/contact/)
— Eric I just have one question regarding the validation rule of an update method.
January 16, 2018
(https://www.qcode.in/easy
How to ash a error message if the validation fails. I want to keep the syntax with
-roles-and-permissions-in- $this->validate
laravel-5-4/#comment-243)
$test = $this->validate($request, [
]);
if( $test->failed() )
else
/*Proceed to validation*/
Or I am obligated to use the “old” method by using the Validator model like this
$validator = Validator::make($request->all(), [
]);
if ($validator->fails()) /*...*/
/
— José Cage Thanks.
QCode (https://www.qcode.in/)
(https://josecage.com)
January 22, 2018
All(https://www.qcode.in/easy
about Full Stack Web Development
-roles-and-permissions-in-
laravel-5-4/#comment-251)
Home About Contact
(http://www.qcode.in) (https://www.qcode.in/about/) (https://www.qcode.in/contact/
I have an error : if I check edit_posts and uncheck the others permissions for the
Home (http://www.qcode.in)
— Yagrademonde User role.
January 28, 2018
(https://www.qcode.in/easy
When I try to access to http://domain/public/posts/4/edit
About (https://www.qcode.in/about/)
-roles-and-permissions-in-
laravel-5-4/#comment-253) (http://domain/public/posts/4/edit)
Contact (https://www.qcode.in/contact/)
I can see the post, but when I want to save my modi cation, I have the error
NotFoundHttpException in Handler.php line 131 : No query results for model
[AppPost] 4.
In my application I wish to not permit to show a list of posts for an user, but with a
given url I want to permit user to edit a certain post.
/
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)
/
QCode (https://www.qcode.in/)
All about Full Stack Web Development
Home (http://www.qcode.in)
About (https://www.qcode.in/about/)
Contact (https://www.qcode.in/contact/)