Rukhsar / laravel-moments by Rukhsar

A laravel trait to deal with time and dates with scope for eloquent models.
166
1
2
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

Laravel Moments

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

  1. currentMinute Parameter : none

  2. lastMinute Parameter : none

  3. currentHour Parameter : none

  4. lastHour Parameter : none

  5. currentDay Parameter : none

  6. lastDay Parameter : none

  7. currentWeek Parameter : none

  8. lastWeek Parameter : none

  9. currentMonth Parameter : none

  10. currentYear Parameter : none

  11. lastYear Parameter : none

  12. lastSeconds Parameter : (int) $countSeconds

  13. lastMinutes Parameter : (int) $countMinutes

  14. lastHours Parameter : (int) $countHours

  15. lastDays Parameter : (int) $countDays

  16. lastWeeks Parameter : (int) $countWeeks

  17. lastMonths Parameter : (int) $countMonths

  18. lastYears Parameter : (int) $countYears