Download the PHP package devchithu/laravel-filter-sorting-searchable without Composer
On this page you can find all versions of the php package devchithu/laravel-filter-sorting-searchable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download devchithu/laravel-filter-sorting-searchable
More information about devchithu/laravel-filter-sorting-searchable
Files in devchithu/laravel-filter-sorting-searchable
Package laravel-filter-sorting-searchable
Short Description This package used to filter, sorting(asc, desc), searchable. php version 7.2^
License MIT
Informations about the package laravel-filter-sorting-searchable
laravel Devchithu-Filter-Sorting-Searchable
This Package for handling dynamic column sorting, filter and searchable in Laravel.
Installation & Usages
Basic Setup
Install via composer; in console:
or require in composer.json:
then run composer update
in your terminal to pull it in.
Once this has finished, you will need to add the service provider to the providers array in your app.php config as follows:
path : project/config/app.php
Find 'providers=>[]' add inside below code (Custom Service Providers...)
Example like code : project/config/app.php
Usages
Use FilterSortSearchable trait inside your Eloquent model(s).
Font Awesome 6.4^ (default font classes)
Install Font-Awesome Search "sort" in cheatsheet and see used icons yourself.
Completed.
Bootstrap 5 version
CSS File
JS File
Publish Js file
then run publish cmd you must to publish only js file and where-ever your want 'filter, sort, searchable' using the below script in blade.php file
See public/filter-sorting-searchable.js (if you want any change update this code inside)
Two method of design filter sorting extension
1. Bootstrap Inline filter sorting Blade Extension
2. Bootstrap filter using Modal, Offcanvas Blade Extension
Two Type of blade extension using script file.
1. Bootstrap Inline filter sorting Blade Extension
Must push that js file in blade, where-ever your want like (better than push that js file into main index blade.php):
OR,
* Sorting
There is a blade extension for you to use @filterSort()
Custom field name sorting
Here,
sorting
parameter default is false.true
is sorting enabled, if don't need sorting just putfalse
or just remove sorting parames.field_name
parameter is column in database table field, name.label_name
parameter is displayed inside anchor tags and print valueable field name. incase oflabel_name
doe'st use automatically get column in database table field.
what are field sorting declare the using your Eloquent model(s) inside function like below code,
Use FilterSortSearchable trait inside your Eloquent model(s).
Eloquent model
Controller's index()
method
* Inline Filter
Blade table config
There is a sorting similar same blade extension for you to use @filterSort()
Custom field name filter
what are field filterable declare the using your Eloquent model(s) inside function like below code,
Controller's index()
method
Sorting & Filter
Incase, If you want sort and filter sametime using below Code,
Here,
filter
parameter default is false.true
is filter enabled, if don't need filter just putfalse
or just remove filter parames.field_name
parameter is column in database table field, name.label_name
parameter is displayed inside anchor tags and print valueable field name. incase oflabel_name
doe'st use automatically get column in database table field.
UI - filter input field automatically generate
- filter is
true
default create input box type = 'text', if you want different input type like (selelect, radio, range) below code put the array params'type' => 'text' // 'type' => 'select' or radio, range
Here, if you select
option using multiple option value data like `'multiple_option' => ['All', 'active', 'in_active']
what are field sorting and filter declare the using your Eloquent model(s) inside function like below code,
Controller's index()
method
Controller's index()
method with paginate()
*Searchable
This searchable global area find the table data
what are field searchable declare the using your Eloquent model(s) inside function like below code,
There is a blade extension for you to use @searchable()
Controller's index()
method
Controller's index()
method
If you want filter, sorting, searchable declare the scope function
*customized filter
If you want filter some field customazed used here file
See app\CustomFilter\CustomFilterTrait.php (if you want any change update this code inside)
what are the customized filter field don't declare (filterable) array. declare custom filterable the using your Eloquent model(s) inside function,
* Binding Params
What are field sorting, searching and filterting below code Which place to you want binding parameters declare the @bindingParams()
Run finally,
OR,
2. Bootstrap filter using Modal, Offcanvas Blade Extension
Publish Js file
then run publish cmd you must to publish only js file your want 'filter, sort, searchable' using the below script in blade.php file
See public/filter-sorting-searchable-modal-offcanvas.js (if you want any change update this code inside)
Must push that js file in blade, where-ever your want like (better than push that js file into main index blade.php):
OR,
Sorting & Filter
Incase, If you want sort and filter sametime using below Code,
Modal Offcanvas Filter
Filter Button
show below code in blade:
Whereever you want filter button put the code @filterBtn()
Default Offcanvas
Here, Bootstrap5^ default offcanvas inside.
Change Custom name
when, if you need button label name change parse the parameter like
Bootstrap5^ Offcanvas and Modal
Default offcanvas don't need any params, if need to change modal window like code :
Bootstrap5 Modal
Here
- viewport is default
offcanvas
if change modal given in array inside - if viewport_direction is
offcanvas
placement direction (like:offcanvas-start, offcanvas-end, offcanvas-top, offcanvas-bottom
) - if viewport_direction is
modal
placement modal-dialog-position (like:modal-dialog-centered, modal-size-(xl)*
)
Run finally,
Don't declare at the sametime two type of js file, at time only one using js file
(filter-sorting-searchable.js Or filter-sorting-searchable-modal-offcanvas.js)
Thank you .