Download the PHP package webard/nova-eloquent-searchable without Composer

On this page you can find all versions of the php package webard/nova-eloquent-searchable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nova-eloquent-searchable

Nova Eloquent Searchable

This simple package comes with two solutions:

  1. Make ability to search Eloquent models by Laravel Nova way, using their search configuration
  2. Introduce additional search classes with optional value validating

Installation

Search Eloquent models like Nova resources

  1. Move public static $search or public static searchableColumns() definition from Nova Resource to Model.
  2. Add trait to your Nova Resource

  3. Add trait to your model:

Now, you can search your models and return values the same way like in Laravel Nova panel:

To not conflict with Laravel Scout, scope was called searchInDatabase, but if you want use other name, e.g. search, just rename Trait method:

Now, you can search by search method:

Additional search classes

Laravel Nova comes with some Searchable Columns Classes, but they can search only via MySQL's LIKE or full-text search.

Full-text search is powerful, but "like" searches on large datasets are very inefficient and they cannot use indexes, so this package derives several additional classes along with value validation functionality to optimize searches.

EqualValue

EqualValue is used to search for full values. This is a simple comparison in MySQL WHERE column="value". This search method is useful, for example, for searching by e-mail address or telephone number.

Additionally, you can add value validation, so that if the passed value does not meet the condition, it will not be added to the search query.

EqualRelation

EqualRelation class do the same thing as EqualValue, but basing on relation instead of column.

Example:

FullTextValue

FullTextValue do the same thing as SearchableText class from Laravel Nova, but additionally adds double quote (") characters to search value. So if you search for John Doe, to SQL query there is sent "John Doe" value. This way, searching in full-text mode is more precise.

Of course value validation like in EqualValue is present too.

FullTextRelation

As above, but works with relations instead of columns.

Of course value validation like in EqualValue is present too.

TODO

I'm are actively seeking contributions to enhance this package. Here are some features I would love to see implemented:

Contributing

We welcome contributions to improve this plugin! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them with descriptive messages.
  4. Push your changes to your forked repository.
  5. Open a pull request to the main repository.

License

This project is licensed under the MIT License. See the LICENSE.md file for more details.

Contact

For questions or support, please open an issue on GitHub.


All versions of nova-eloquent-searchable with dependencies

PHP Build Version
Package Version
Requires laravel/nova Version ^4.20
illuminate/contracts Version ^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webard/nova-eloquent-searchable contains the following files

Loading the files please wait ....