PHP code example of urameshibr / pg-interval-support

1. Go to this page and download the library: Download urameshibr/pg-interval-support 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/ */

    

urameshibr / pg-interval-support example snippets


$table->addColumn('interval', 'field_name')

// The format: 
DB::table('table_name')->whereInterval('field_name', 'operator', 'interval')

// Example 1
DB::table('tours')->whereInterval('duration', '>=', '02:00:00')->get()

// Example 2
DB::table('tours')->whereInterval('duration', '>=', '2 hours')->get()

// Example 3
YourModel::whereInterval('duration', '>=', '2 hours')->get()