Comments (4)
@dratnayake can you show your User.php?
from rbac.
Hi, thank you for the reply.
Below is the User.php
<?php
/**
* Created by Reliese Model.
* Date: Wed, 07 Mar 2018 00:10:07 +0000.
*/
namespace App\Models;
use \YaroslavMolchan\Rbac\Traits\Rbac;
use Reliese\Database\Eloquent\Model as Eloquent;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Auth\Authenticatable as AuthenticableTrait;
/**
* Class User
*
* @property int $id
* @property string $name
* @property string $email
* @property string $password
* @property string $remember_token
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
*
* @property \Illuminate\Database\Eloquent\Collection $assignment_histories
* @property \Illuminate\Database\Eloquent\Collection $requests
* @property \Illuminate\Database\Eloquent\Collection $roles
* @property \Illuminate\Database\Eloquent\Collection $tickets
* @property \Illuminate\Database\Eloquent\Collection $user_profiles
* @property \Illuminate\Database\Eloquent\Collection $user_subscriptions
*
* @package App\Models
*/
class User extends Eloquent implements Authenticatable
{
use AuthenticableTrait;
use Rbac;
protected $hidden = [
'password',
'remember_token'
];
protected $fillable = [
'name',
'email',
'password',
'remember_token'
];
public function assignment_histories()
{
return $this->hasMany(\App\Models\AssignmentHistory::class, 'assigned_to');
}
public function requests()
{
return $this->hasMany(\App\Models\Request::class);
}
public function roles()
{
return $this->belongsToMany(\App\Models\Role::class);
}
public function tickets()
{
return $this->hasMany(\App\Models\Ticket::class, 'send_to');
}
public function user_profiles()
{
return $this->hasMany(\App\Models\UserProfile::class);
}
public function user_subscriptions()
{
return $this->hasMany(\App\Models\UserSubscription::class);
}
}
from rbac.
@dratnayake you need to remove relation roles
from your model, trait do it for you: https://github.com/YaroslavMolchan/rbac/blob/master/src/Traits/Rbac.php#L8
And also you don't need to create your own model \App\Models\Role
, package use own: https://github.com/YaroslavMolchan/rbac/blob/master/src/Models/Role.php
from rbac.
cool thanks. working now.
from rbac.
Related Issues (8)
- Migration Error HOT 6
- cannot find yaroslavmolchan/rbac ^2.0
- @ifUserCan('product.create') - It doesn't work HOT 1
- check permission
- Proposal redirect HOT 1
- How to add child roles for a role? HOT 2
- Is there any way to access the permission groups while specifying the routers instead of roles and permissions ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rbac.