1. Go to this page and download the library: Download fereydooni/unixtime 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/ */
fereydooni / unixtime example snippets
use Fereydooni\Unixtime\HasTimestampEquivalents;
class Customer extends Model
{
use HasTimestampEquivalents;
}
class Customer extends Model
{
use HasTimestampEquivalents;
// Only manage these columns (otherwise they are auto-discovered from the DB)
protected $timestampEquivalentColumns = ['created_at', 'last_order_date'];
// Skip columns even if they look like datetimes
protected $excludedTimestampColumns = ['date_of_birth'];
// Customize suffix (default: '_unix')
protected $timestampColumnSuffix = '_timestamp';
}
// Uses created_at_unix behind the scenes
Customer::latest()->take(50)->get();
// orderByDesc('shipped_at') becomes shipped_at_unix when available
Order::orderByDesc('shipped_at')->paginate();