zaimealabs / searches
The ZaimeaLabs Searches package.
Fund package maintenance!
Custura
1.1
2025-03-25 10:43 UTC
Requires
- php: ^8.2|^8.3|^8.4
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- mockery/mockery: ^1.4.4
- orchestra/testbench: ^8.0|^9.0|^10.0
- pestphp/pest: ^2.0|^3.0
README
Generate pdf in your application.
Hey 👋 thanks for considering making a donation, with these donations I can continue working to contribute to ZaimeaLabs projects.
Usage
use ZaimeaLabs\Searches\Search; $results = Search::in(User::class, 'name') ->search('Custura');
Use ->when()
Search::new() ->when($user->isAdmin(), fn($search) => $search->in(User::class, 'name')) ->search('Custura');
Multiple column
Search::in(User::class, ['name', 'username']) ->search('Custura');
Search through relationships
Search::in(User::class, ['posts.title']) ->search('laravel');
Eager load relationships
Search::in(Post::with('comments'), 'title') ->in(Video::with('likes'), 'title') ->search('laravel');
Multi-words
use ZaimeaLabs\Searches\Search; Search::in(Blog::class, 'title') ->in(Video::class, 'title') ->search('"laravel livewire alpine"');
Sorting
->orderByDesc()
->orderByRelevance()
->orderByModel([Post::class, Video::class,])
Paginate
->paginate() ->paginate($perPage = 10, $pageName = 'page', $page = 1) # OR ->simplePaginate() ->simplePaginate($perPage = 10, $pageName = 'page', $page = 1)