rukhsar / moments
A laravel trait to deal with time and dates with scope for eloquent models.
Requires
- php: >=5.4.0
- laravel/framework: >=5.2
This package is not auto-updated.
Last update: 2024-12-08 01:40:13 UTC
README
A laravel trait to deal with time and dates with scope for eloquent models.
Installation
Install using composer
composer require rukhsar/moments
Usage
Update your Eloquent Models
Simply call Moments
trait in your model using use Rukhsar\Moments\Moments
.
<?php namespace App; use Rukhsar\Moments\Moments; class User extends Model { use Moments; // your remaining model class content }
Then you can call Moments scopes like below
<?php
$users = User::currentDay()->get();
Available Methods
-
currentMinute
Parameter : none -
lastMinute
Parameter : none -
currentHour
Parameter : none -
lastHour
Parameter : none -
currentDay
Parameter : none -
lastDay
Parameter : none -
currentWeek
Parameter : none -
lastWeek
Parameter : none -
currentMonth
Parameter : none -
currentYear
Parameter : none -
lastYear
Parameter : none -
lastSeconds
Parameter :(int) $countSeconds
-
lastMinutes
Parameter :(int) $countMinutes
-
lastHours
Parameter :(int) $countHours
-
lastDays
Parameter :(int) $countDays
-
lastWeeks
Parameter :(int) $countWeeks
-
lastMonths
Parameter :(int) $countMonths
-
lastYears
Parameter :(int) $countYears