Package Data | |
---|---|
Maintainer Username: | Rukhsar |
Maintainer Contact: | rukhsar.man@gmail.com (Rukhsar Manzoor) |
Package Create Date: | 2016-12-01 |
Package Last Update: | 2016-12-01 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-15 15:15:02 |
Package Statistics | |
---|---|
Total Downloads: | 166 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 0 |
A laravel trait to deal with time and dates with scope for eloquent models.
Install using composer
composer require rukhsar/moments
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();
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