Skip to content

for extended model undefined method App\Models\Role::hasRole() #1687

Answered by drbyte
MehranLabour asked this question in Q&A
Discussion options

You must be logged in to vote

i extended role model (placed in : App\Models\Role) and the code below is extended model,
i used this doc

<?php

namespace App\Models;

use Spatie\Permission\Traits\HasPermissions;
use Spatie\Permission\Traits\RefreshesPermissionCache;

use Spatie\Permission\Contracts\Role As RoleContract;

use Spatie\Permission\Models\Role as SpatiteRole;

class Role extends SpatiteRole implements RoleContract
{

    use HasPermissions;
    use RefreshesPermissionCache;
 
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        $this->fillable []= 'persian_name' ;
    }
    
}

That seems overly complex.

Why not just:

<?php

namespace App\Models;

use

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@MehranLabour
Comment options

@drbyte
Comment options

Answer selected by MehranLabour
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants