https://github.com/mostafaznv/nova-morph-filter
Morph Filter for Laravel Nova
https://github.com/mostafaznv/nova-morph-filter
filter laravel morph nova
Last synced: 12 months ago
JSON representation
Morph Filter for Laravel Nova
- Host: GitHub
- URL: https://github.com/mostafaznv/nova-morph-filter
- Owner: mostafaznv
- License: apache-2.0
- Created: 2022-01-30T22:46:10.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-04T20:54:12.000Z (about 3 years ago)
- Last Synced: 2025-03-24T00:25:17.497Z (about 1 year ago)
- Topics: filter, laravel, morph, nova
- Language: Vue
- Homepage: https://novapackages.com/packages/mostafaznv/nova-morph-filter
- Size: 130 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://packagist.org/packages/mostafaznv/nova-morph-filter)
[](LICENSE.txt)
[](https://packagist.org/packages/mostafaznv/nova-morph-filter)
# Morph Filter for Laravel Nova
Morph filter fields for laravel nova
----
I develop in a open-source journey 🚀, I wish I lived in an environment where financial situation was fine and I could only focus on the path, but as you may know, life isn't perfect.
So if you end up using my packages, please consider making a donation, any amount would go along way and is much appreciated. 🍺
[](https://mostafaznv.github.io/donate)
----
## Requirements:
- PHP 8.0 or higher
- Laravel 8.* or higher
## Installation
Install using composer:
```
composer require mostafaznv/nova-morph-filter
```
## Usage
```
use Mostafaznv\NovaMorphFilter\NovaMorphFilter;
class Post extends Resource
{
...
public function fields(Request $request): array
{
return [
...
MorphTo::make(trans('Owner'), 'owner')
->types([Admin::class, User::class])
];
}
public function filters(Request $request): array
{
return [
(new NovaMorphFilter(trans('Owner'), 'owner'))
->types([User::class, Admin::class])
];
}
}
```
----
I develop in a open-source journey 🚀, I wish I lived in an environment where financial situation was fine and I could only focus on the path, but as you may know, life isn't perfect.
So if you end up using my packages, please consider making a donation, any amount would go along way and is much appreciated. 🍺
[](https://mostafaznv.github.io/donate)
----
## Changelog
Refer to the [Changelog](CHANGELOG.md) for a full history of the project.
## License
This software released under [Apache License Version 2.0](LICENSE.txt).
(C) 2022 Mostafaznv, All rights reserved.