Download the PHP package tasdan/column-searchable without Composer

On this page you can find all versions of the php package tasdan/column-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 column-searchable

Searching in model's columns for Laravel 5.5-8

A package for searching in your eloquent model's column, with relations in Laravel.

Table of contents

Installation

Composer

Install the package with composer require command:

Service provider

Next, add the new provider to the providers array in config/app.php (only when Laravel < 5.5):

Configuration

You can publish the configuration file with the following command:

After that, you can change the default configurations in file.

Usage

To use searchable scope, you have to add Searchable trait inside the Eloquent models. Searchable trait adds Searchable scope to the models. Then define $searchable array in model's definition (check the configuration section to more info):

After you defined the $searchable array, you can use searchable scope in your controllers:

You can execute a search function when the requested URL has one of the defined $searchable key, see this example:

Note: the parameter values in URL are URL-encoded.

Configurations

You can configure search field as much as you want, with the following pattern:

Config examples

Blade Extension

There are two blade extension for you to use searchable functions

Searchable input field

In blade files you can use the @searchablefield() extension to automatically generated search input form.

Note: the search-input class automatically added to this generated fields, to able to work the @searchablescript() extension.

This first parameter (field_type) must be one of the following:

The second parameter is the searchable field name, which is already defined in model's $searchable array. The third parameter is the title-placeholder value of the field. The fourth parameter depends on the type parameter:

The fifth parameter is optional when type is select, and this is an array with additional form values.

Possible examples and usages of this balde extension:

Searchable script

In blade files you can use the @searchablescript() extension to automatically generated search Javascript functions. After this you can call search() function to execute a search request.

Example use of @searchablescript() extension:

Note: you have to call @searchablescript() extension inside script tag, because this extension returns only with JS functions code. In this way, you can use CSP-nonce on this include.

Pagination

If you use pagination in blade, you have to update the pagination links, to keep searching parameters in URL when page change.

Full example

TODO

Library Note:

This is my first Laravel package, so maybe there is some problem with that, but I will handle those as soon as possible.

License

This package is free software distributed under the terms of the MIT license. Enjoy!


All versions of column-searchable with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0|^8.0
illuminate/support Version 5.8.*|^6.0|^7.0|^8.0|^9.0|^10.0
illuminate/database Version 5.8.*|^6.0|^7.0|^8.0|^9.0|^10.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 tasdan/column-searchable contains the following files

Loading the files please wait ....