Skip to content

Commit

Permalink
[Merge] update: config Resource Model #33
Browse files Browse the repository at this point in the history
  • Loading branch information
kiritokatklian authored May 17, 2024
2 parents d2c8a5b + 702b12d commit d4135f4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
15 changes: 15 additions & 0 deletions src/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ class Permission extends Resource
'roles',
];

/**
* Create a new resource instance.
*
* @param TModel|null $resource
* @return void
*/
public function __construct($resource = null)
{
static::$model = static::getModel();
$this->resource = $resource;
}

/**
* The model the resource corresponds to.
*/
public static function getModel()
{
return app(PermissionRegistrar::class)->getPermissionClass();
Expand Down
21 changes: 18 additions & 3 deletions src/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ class Role extends Resource
'permissions',
];

/**
* Create a new resource instance.
*
* @param TModel|null $resource
* @return void
*/
public function __construct($resource = null)
{
static::$model = static::getModel();
$this->resource = $resource;
}

/**
* The model the resource corresponds to.
*/
public static function getModel()
{
$object = app(PermissionRegistrar::class)->getRoleClass();
Expand Down Expand Up @@ -167,11 +182,11 @@ public function actions(NovaRequest $request)
{
return [];
}

/**
*
*
* Allow the permissions to replicate with the Role
*
*
* @return Role|HigherOrderTapProxy|mixed
*/
public function replicate()
Expand Down

0 comments on commit d4135f4

Please sign in to comment.