Questions tagged [entrust]

Entrust is a plugin to add role-based permissions to Laravel.

115 questions
3
votes
3 answers

assign separate middleware to each method of a resource in laravel

I am using Zizaco/entrust laravel package as a ACL Manager for my project. I know that for limit access to a route group via middlewares and assign a role (or permission) to it, I should do that like this: Route::group(['prefix' => 'admin',…
Ahmad Badpey
  • 6,348
  • 16
  • 93
  • 159
3
votes
1 answer

Eloquent IF clause - always returns true

I am using Entrust's default table structure: permissions table: +--------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra …
Emile Pels
  • 3,837
  • 1
  • 15
  • 23
3
votes
2 answers

Exception when using Entrust middleware in Laravel 5.1

I have installed the Entrust package in my Laravel 5.1 application by adding it to my composer.json file and running composer update and followed all of the instructions to the letter. I am trying to use their middleware to protect some routes but I…
geoffs3310
  • 5,599
  • 11
  • 51
  • 104
2
votes
1 answer

Getting error Method Illuminate\Database\Eloquent\Collection::getKey does not exist. in laravel, how to fix it?

During assigning roles in laravel by using entrust i am getting error Method Illuminate\Database\Eloquent\Collection::getKey does not exist. My code is : $record = new User(); $data = $request->all(); $record->fill($data); …
Ranjeet
  • 539
  • 5
  • 12
2
votes
1 answer

PDF document signing with Google KMS and Entrust certificate

I am trying to make a valid signature in a pdf document by using a certificate from CA (Entrust) generated with a private key from Google KMS (private key never goes out from the KMS). The certificate chain is made as: [entrustCert, intermediate,…
ghovat
  • 1,033
  • 1
  • 12
  • 38
2
votes
0 answers

PDOException::("SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'admin' for key 'roles_name_unique'")

I'm new to the Laravel entrust package. I'm trying to run a database seeder migration but everytime I do so it brings the following error PDOException::("SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'admin' for key…
tngeene
  • 370
  • 2
  • 7
2
votes
0 answers

Laravel Entrust User With Roles Returns an Empty Array

I am using Laravel 5.5 with Zizaco Entrust Library. https://github.com/Zizaco/entrust I setup the models for Role, Permission and User according to the documentation. users Table: +----+-------+-----------------+--+ | id | name | email | …
Saad
  • 1,155
  • 3
  • 16
  • 36
2
votes
1 answer

Laravel save() not working on new object

I'm trying to use the code provided by the documentation of entrust in a controller but save() method wont execute and gives me the error Method [save] does not exist on [App\Http\Controllers\role] Here is the code: $cityadmin = new…
the inquisitor
  • 99
  • 1
  • 1
  • 4
2
votes
1 answer

Location of entrust roles and permissions code

I am new to Laravel and trying to use enrtust plugin for roles and permissions, but when following the instructions in the documentation, I reached the bit where I have to put the code that creates the roles and permissions, but it did not mention…
the inquisitor
  • 99
  • 1
  • 1
  • 4
2
votes
0 answers

Laravel Policies VS Roles/Permissions Implementation

I have implemented small test code with Laravel Policies . I am wondering whether this is the right method to implement an roles based permission system. I also used Entrust Role Permission package too. My requirement is as follows : 1. List of…
2
votes
1 answer

how to implement entrust in laravel 5.4

Hi I am new with the use of laravel.I can't understand how to create multiple role user. I want to create an admin and general user . I want to use entrust (https://github.com/Zizaco/entrust) if possible. I am using Laravel 5.4 and install entrust.…
Shafayet Rahat
  • 234
  • 3
  • 13
2
votes
2 answers

Entrust - This cache store does not support tagging in Laravel 5.1

After searching all possible answers, I still dont know how to solve this problem. I'm using zizaco/entrust package for laravel, and everytime I save data into the database it returns an error: BadMethodCallException in Repository.php line 294: …
Mr. J
  • 245
  • 6
  • 24
2
votes
1 answer

Laravel Entrust, query where users do not have a role

I would like to return all users that do not have various relationship existences, and various roles. At the moment, this works correctly: User::doesntHave('trusts') ->doesntHave('sites') ->pluck('email', 'name', 'id'); What I would…
user860511
2
votes
1 answer

Zizaco/entrust Saving permission uses roles table

I am using the dependency of Zizaco/entrust for creating roles and their permissions in my webapplication, which is build in laravel 5.3. The problem I am having is (as the title says) whenever I try to save a newly created Permission. It is stored…
Hoffie
  • 325
  • 2
  • 14
2
votes
3 answers

Laravel 5.3 - Best way to implement Entrust role on signup?

I'm working with Laravel 5.3 and I'm trying to set a role when someone signs up, I've used the Zizaco Entrust library. I'm unsure on the best way to achieve something like this. I tried to do this inside RegisterController's create method like…
Andy Holmes
  • 7,817
  • 10
  • 50
  • 83