This simple package helps you filter Eloquent data using query filters.
Run the following command:
composer require nahidulhasan/eloquent-filter
Use the trait
NahidulHasan\EloquentFilter\Filterable in your eloquent model.
Create a new class by extending the class
NahidulHasan\EloquentFilter\QueryFilters and define your custom filters as methods with one argument. Where function names are the filter argument name and the arguments are the value.
Let's assume you want to allow to filter articles data. Please see the following code.
<?php namespace App\Models;
class Article extends Model
Create ArticleFilter class extending QueryFilters.
class ArticleFilters extends QueryFilters
With this class we can use the http query string :
title=article_name or any combination of these filters. It is up to you to define if you will use AND wheres or OR.
Now in the controller you can apply these filters like as described in below :
If you go to this link you will get all code: https://github.com/nahidulhasan/laravel-eloquent-query-filtering
Thanks to : https://github.com/laracasts/Dedicated-Query-String-Filtering
Thanks for reading ❤
If you liked this post, share it with all of your programming buddies!
Follow me on Facebook | Twitter
☞ Laravel 6 CRUD Application Tutorial
☞ Laravel 6 Image Upload Tutorial
☞ Laravel 6 Authentication Tutorial
#laravel #php #web-development
Hello everyone! I just updated this tutorial for Laravel 8. In this tutorial, we’ll go through the basics of the Laravel framework by building a simple blogging system. Note that this tutorial is only for beginners who are interested in web development but don’t know where to start. Check it out if you are interested: Laravel Tutorial For Beginners
Laravel is a very powerful framework that follows the MVC structure. It is designed for web developers who need a simple, elegant yet powerful toolkit to build a fully-featured website.
#laravel 8 tutorial #laravel 8 tutorial crud #laravel 8 tutorial point #laravel 8 auth tutorial #laravel 8 project example #laravel 8 tutorial for beginners
#laravel #laravel 8 tutoral #laravel 8 tutorial for beginners #laravel 8 tutorial for beginners step by step #laravel 8 tutorial from scratch
In this tutorial, i will provide you some useful tutorial of laravel 8 version. So, you can learn laravel 8 an easy way.
#laravel 8 tutorial for beginners #laravel 8 tutorial for beginners step by step #laravel 8 tutorial #laravel 8 authentication tutorial
In this Laravel tutorial, we will learn how to install laravel and how to create your first app in laravel for beginners. Now you can learn laravel easily without the need of watching laravel video series or laravel video tutorials. This laravel tutorial will explain all the necessary concepts in easy language for you to learn laravel easily and understand it better.
#Laravel #laravel tutorial #laravel tutorial for beginner #learn laravel #learn laravel for free
In this tutorial.I will learn you how to use dynamic char bar using google charts in laravel.you can easy and simply use dynamic chart in laravel.
Google has provide us different type of Google chart. So, in this post we are going to create dynamic bar chart by using Google Chart API in Laravel application.
I will just create a simple employee model and a employee controller to create this laravel google charts example. Then i will fetch employee data from database and finally set in google bar chart function.
Link :- https://www.nicesnippets.com/blog/laravel-google-bar-charts-example-tutorial
#laravel #laravel tutorial #laravel tutorial for beginner #learn laravel #learn laravel for free