Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mstdmstd's avatar

How to extend Spatie\Permission\Models\Permission model ?

Hello, In my Laravel 8 app with "spatie/laravel-permission": "^3.18" installed I need to expend Permission table : to add info text field.

I wonder which is correct way to do ? Now in my controls I refere this model

use Spatie\Permission\Models\Permission;

which refs file at vendor/spatie/laravel-permission/src/Models/Permission.php

Have to copy this file under app/Models/ directory and edit it as usual file and refer it as

use App\Models\Permission;

Or some other way?

Thanks!

0 likes
3 replies
MichalOravec's avatar
Level 75

app\Models\Permission.php

<?php

namespace App\Models;

use Spatie\Permission\Models\Permission as Model;

class Permission extends Model
{
    //
}

And then in controller import your Permission model.

use App\Models\Permission;
2 likes
mstdmstd's avatar

Thanks!. Does it mean that app\Models\Permission.php inherited all from Spatie\Permission\Models\Permission ?

Please or to participate in this conversation.