PHPackages                             trinityrank/nova-resource-remove - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. trinityrank/nova-resource-remove

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

trinityrank/nova-resource-remove
================================

LaravelNovaResourceRemove - safe remove resource which is related to the another table and assign to another resource

v0.1.1(3y ago)027MITPHPPHP ^8.0

Since Mar 8Pushed 3y ago1 watchersCompare

[ Source](https://github.com/trinity-rank/nova-resource-remove)[ Packagist](https://packagist.org/packages/trinityrank/nova-resource-remove)[ Docs](https://github.com/trinity-rank/nova-resource-remove)[ RSS](/packages/trinityrank-nova-resource-remove/feed)WikiDiscussions master Synced today

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Installation
------------

[](#installation)

### Step 1: Install package

[](#step-1-install-package)

To get started with Nova Resource Remove, use Composer command to add the package to your composer.json project's dependencies:

```
    composer require trinityrank/nova-resource-remove
```

### Step 2: Configuration

[](#step-2-configuration)

- You need to import class in Nova ressource

```
    use Trinityrank\LaravelNovaResourceRemove\NovaResourceRemove;
```

- And then you need add actions function in Nova ressource
- It is strongly recommended to use onlyOnTableRow()
- The first parameter is the path of the resource-related model
- The second is the name of foreign key column
- 3rd parameter is the name of the foreign table to which the model is attached

```
    public function actions(Request $request)
    {
        return [
            (new NovaResourceRemove(
                ['\App\Models\Types\Category', 'category_id', ['categoriables']]
            ))->confirmButtonText('Remove Category')->onlyOnTableRow()
        ];
    }
```

- If you want to authorize an action not to appear for a particular resource

```
    public function actions(Request $request)
    {
        return [
            (new  NovaResourceRemove(
                ['\App\Models\User', 'user_id', ['pages','articles']]
            ))->canSee(function ($request) {
                return !$this->model()->hasRole(['Super Admin']);
            })->confirmButtonText('Remove User')->onlyOnTableRow()
        ];
    }
```

### Step 3: Additional Configuration

[](#step-3-additional-configuration)

- When a action is added to a resource that has an associated authorization policy, the policy's delete method must return false.

```
