for extended model undefined method App\Models\Role::hasRole() #1687
-
my laravel version is: 6.2
and in config/permission.php i changed the default role model of packege like below code:
am i did the steps right? okay what is my problem? assume
'permissions' table is like below
my problem is when i want to use my new Role model like below code if Role model does not have the permission throw an error
then below error will thrown
but if i use SpatieRole model i mean the original model for finding role as below code
nothing will thrown and result is i think some functions is not inherited by extended model, any help will be useful |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
That seems overly complex. Why not just: <?php
namespace App\Models;
use Spatie\Permission\Models\Role as SpatieRole;
class Role extends SpatieRole
{
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->fillable []= 'persian_name' ;
}
} |
Beta Was this translation helpful? Give feedback.
That seems overly complex.
Why not just: