tattersoftware / codeigniter4-permits

Model permission handling for CodeIgniter 4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tatter\Permits\Models\PModel is not correct for v2.0.0

SergeTkach opened this issue · comments

Hi!
I just have installed the package tatter/permits on my CodeIgniter 4 and it was not in such a way as is indicated in instruction here and on the site https://packagist.org/packages/tatter/permits

In short:


BAD:
class JobModel extends Tatter\Permits\Models\PModel;

GOOD:
class JobModel extends Tatter\Permits\Models\PermitModel;


BAD:

// app/Models/JobModel.php
class JobModel extends Tatter\Permits\Model
{

GOOD:

// app/Models/JobModel.php
class JobModel extends \Tatter\Permits\Models\PermitModel
{

Oops! Thanks for pointing that out. It looks like the full docs are correct (midway down the README) but I missed the Quick Start. I will get that updated. Also, I strongly recommend using the trait unless you’re really really sure you won’t need to make model changes down the road. Cheers!

Okay, updating this now. FYI you should not use Tatter\Permits\Models\PermitModel as that is actually the model used by the module to look up permissions! You want to use the model in project root:

// app/Models/JobModel.php
class JobModel extends \Tatter\Permits\Model
{

Be sure to qualify the namespace back to root if you don't have a use statement. But see also my plug for using the trait!