PHP code example of omar-elnaghy / laradate-filters
1. Go to this page and download the library: Download omar-elnaghy/laradate-filters 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/ */
omar-elnaghy / laradate-filters example snippets
use Illuminate\Database\Eloquent\Model;
use OmarElnaghy\LaraDateFilters\Traits\Builder\PackageBuilder;
class YourModel extends Model
{
public function newEloquentBuilder($query)
{
return new PackageBuilder($query);
}
}
// [Duration] is a number refer to the number of [Date Unit] you want to search in
return Post::filterByDate(Duration)(Date Unit)Range($startDate, $direction, $range)->get();