PHP code example of hamidreza-mozhdeh / filter-by-query-string

1. Go to this page and download the library: Download hamidreza-mozhdeh/filter-by-query-string library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hamidreza-mozhdeh / filter-by-query-string example snippets


trait CategoryScopesTrait
{
    public function scopeName(Builder $query, string $name): Builder
    {
        return $query->where('name', 'like', "%{$name}%");
    }

    public function scopeDateBetween(Builder $query, string $from, string $to): Builder
    {
        return $query->whereBetween('created_at', [$from, $to]);
    }
}