Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

laravel 5.3 Declaration of Illuminate\Database\Eloquent\Model::is() must be compatible with Bican\Roles\Contracts\HasRoleAndPermission::is($role, $all = false) #190

Closed
Pa6 opened this issue Sep 10, 2016 · 14 comments

Comments

@Pa6
Copy link

Pa6 commented Sep 10, 2016

while running romanbincan seed

here is my user model:
use Illuminate\Auth\Authenticatable;
use Bican\Roles\Traits\HasRoleAndPermission;

use Bican\Roles\Contracts\HasRoleAndPermission as HasRoleAndPermissions;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\Notifiable;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract, HasRoleAndPermissions
{
use Authenticatable, CanResetPassword, HasRoleAndPermission, Notifiable;

@nikolaynesov
Copy link

Did that work before on Laravel 5.2 ?
Did you try this:
#189 ?

@Pa6
Copy link
Author

Pa6 commented Sep 10, 2016

Yes he same code on laravel 5.2 works, but on this new version nop

@nikolaynesov
Copy link

@Pa6 Did you try this:
#189 ?

@Pa6
Copy link
Author

Pa6 commented Sep 10, 2016

yes I tried also but no change @nikolaynesov

@nikolaynesov
Copy link

nikolaynesov commented Sep 11, 2016

@Pa6 sorry I was not able to reproduce your error with my recent pull request #189 but maybe if someone else will report or confirm the issue we can come back to it again. Thank you for your effort.

@blakeage
Copy link

I had the same error, and #189 seems to have fixed it for me.

@nikolaynesov
Copy link

nikolaynesov commented Sep 14, 2016

@Pa6 Are you still experiencing this error today?
@blakeage it fixed the issue for me too.
@emiliomedina21 should have fixed it in his recent commits and they are included in #189
Anybody else experiencing the same issue?

@emiliomedina21
Copy link

@Pa6 Please review #189 (method is() has conflicts with Model::is() ). It was fixed.

@Pa6
Copy link
Author

Pa6 commented Sep 15, 2016

@nikolaynesov it is fixed now. Thanks

@Pa6 Pa6 closed this as completed Sep 15, 2016
@LucaColombi
Copy link

Hello,

I have the same issue on 5.4, seems that Model declare a new is() method that conflicts with code that used this metods on Model subclasses

@LucaColombi
Copy link

for compatibility it would be better to name the new metod equals(), since it is more standard for object comparing, moreover is() is often user to verify boolean attributes: is('enabled'), is('admin'), etc.... (that's my case)

@Pa6
Copy link
Author

Pa6 commented Mar 15, 2017

@LucaColombi check the issue #189, It is fixed for laravel 5.4 as well!

@sanslash332
Copy link

Hello, I have the same issue, with laravel 5.4, and roles was installed using require bican/roles:dev-master --dev
This is the displayed exception:

Whoops, looks like something went wrong.

(1/1) FatalErrorException

Declaration of Illuminate\Database\Eloquent\Model::is() must be compatible with Bican\Roles\Contracts\HasRoleAndPermission::is($role, $all = false) 

in
User.php (line 14)

Is a clean installation of laravel 5.4 without add anythin more tan bican/roles. This is mi User.php File:

@sanslash332
Copy link

sorry for the doble post (i can't find the edit button) this is the code of the file:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants