PHPackages                             paxha/laravel-reportable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. paxha/laravel-reportable

ActiveLaravel[Utility &amp; Helpers](/categories/utility)

paxha/laravel-reportable
========================

This Laravel Eloquent extension provides record according to dates using models.

v1.2.0(5y ago)111.2k2[1 issues](https://github.com/paxha/laravel-reportable/issues)MITPHPPHP ^7.2|^8.0

Since Dec 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/paxha/laravel-reportable)[ Packagist](https://packagist.org/packages/paxha/laravel-reportable)[ RSS](/packages/paxha-laravel-reportable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (5)Used By (0)

Laravel Report Generator
========================

[](#laravel-report-generator)

Introduction
------------

[](#introduction)

This Laravel Eloquent extension provides record according to dates using models.

[![Build Status](https://camo.githubusercontent.com/70492a976d9e0f67edb0f26fae5982147c4e1e7111ec5d7278d81da4afda9461/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f70617868612f6c61726176656c2d7265706f727461626c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/paxha/laravel-reportable)[![StyleCI](https://camo.githubusercontent.com/8d5c56a3b765d74cb054b6e161907a90d049bf0d9c6ba29e783e4d63e1d15b0e/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3233303430343030382f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/230404008)[![Total Downloads](https://camo.githubusercontent.com/583386e75309ffc5f47575cc64266797d5a6aa69cdacfd0108973ad8897356ab/68747470733a2f2f706f7365722e707567782e6f72672f70617868612f6c61726176656c2d7265706f727461626c652f642f746f74616c2e7376673f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/paxha/laravel-reportable)[![Latest Stable Version](https://camo.githubusercontent.com/7dcd2a8b2c8f33cac6a081cfa45048982ca4a6206eaca51fa83d161a02d772e6/68747470733a2f2f706f7365722e707567782e6f72672f70617868612f6c61726176656c2d7265706f727461626c652f762f737461626c652e7376673f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/paxha/laravel-reportable)[![License](https://camo.githubusercontent.com/aaef34d509c01936488225893bf5f5697159c551f16f28fe4cd257fc83a88237/68747470733a2f2f706f7365722e707567782e6f72672f70617868612f6c61726176656c2d7265706f727461626c652f6c6963656e73652e7376673f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/paxha/laravel-reportable)

This package provides an event that will generate a unique slug when saving or creating any Eloquent model.

Installation
------------

[](#installation)

```
composer require paxha/laravel-reportable

```

Usage
-----

[](#usage)

- [Getting Started](#getting-started)
- [Scopes](#scopes)
    - [Yearly Report](#yearly-report)
    - [ThisYear Report](#this-year-report)
    - [LastYear Report](#last-year-report)
    - [Monthly Report](#monthly-report)
    - [ThisMonth Report](#this-month-report)
    - [LastMonth Report](#last-month-report)
    - [This Week Report](#this-week-report)
    - [Last Week Report](#last-week-report)
    - [Daily Report](#daily-report)
    - [Today Report](#today-report)
    - [Yesterday Report](#yesterday-report)
    - [Hourly Report](#hourly-report)
- [Custom Query](#custom-query)
- [Advanced Usage](#advanced-usage)

### Getting Started

[](#getting-started)

Consider the following table schema for hierarchical data:

```
Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->timestamps();
});
```

Use the `Reportable` trait in your model to work with reports:

```
class User extends Model
{
    use \Reportable\Traits\Reportable;
}
```

### Scopes

[](#scopes)

The trait provides query scopes to filter data by datetime:

- [`yearlyReport($year = null)`](#yearly-report): provide year-wise record. By default it will provide current year record.
- [`thisYearReport()`](#this-year-report): provide current year record.
- [`lastYearReport()`](#last-year-report): provide previous year record.
- [`monthlyReport($month = null, $year = null)`](#monthly-report): provide month-wise record. By default it will provide current month.
- [`thisMonthReport()`](#this-month-report): provide current month record.
- [`lastMonthReport()`](#last-month-report): provide last month record.
- [`thisWeekReport()`](#this-week-report): provide this week record. (mon - sun)
- [`lastWeekReport()`](#last-week-report): provide last week record. (mon - sun)
- [`dailyReport($date = null)`](#daily-report): provide date-wise record. By default it will provide today's record.
- [`todayReport()`](#today-report): provide today record.
- [`yesterdayReport()`](#yesterday-report): provide yesterday record.
- [`hourlyReport($from = null, $to = null, $date = null)`](#hourly-report): provide hour-wise record. By default it will provide records between last hour to current hour.

#### Yearly Report

[](#yearly-report)

```
/*Only Current Year Users*/
$users = User::yearlyReport()->get();

// or

/*2018 Users*/
$year = 2018; // or Carbon date
$users = User::yearlyReport($year)->get();
```

#### This Year Report

[](#this-year-report)

```
/*Only Current Year Users*/
$users = User::thisYearReport()->get();
```

#### Last Year Report

[](#last-year-report)

```
/*Only Last Year Users*/
$users = User::lastYearReport()->get();
```

#### Monthly Report

[](#monthly-report)

```
/*Only Current Month Users*/
$users = User::monthlyReport()->get();

// or

/*November Current Year Users*/
$month = 11; // or Carbon date
$users = User::monthlyReport($month)->get();

// or

/*November 2018 Year Users*/
$month = 11; // or Carbon date
$year = 2018; // or Carbon date
$users = User::monthlyReport($month, $year)->get();
```

#### This Month Report

[](#this-month-report)

```
/*Only Current Month Users*/
$users = User::thisMonthReport()->get();
```

#### Last Month Report

[](#last-month-report)

```
/*Only Last Month Users*/
$users = User::thisMonthReport()->get();
```

#### This Week Report

[](#this-week-report)

```
/*Only Current Week Users (Mon - Sun)*/
$users = User::thisWeekReport()->get();
```

#### Last Week Report

[](#last-week-report)

```
/*Only Last Week Users (Mon - Sun)*/
$users = User::lastWeekReport()->get();
```

#### Daily Report

[](#daily-report)

```
/*Only Today's Users*/
$users = User::dailyReport()->get();

// or

/*December 27, 2019 Users*/
$date = '2019-12-27'; // or Carbon date
$users = User::dailyReport($date)->get();
```

#### Today Report

[](#today-report)

```
/*Only Today's Users*/
$users = User::todayReport()->get();
```

#### Yesterday Report

[](#yesterday-report)

```
/*Only Yesterday's Users*/
$users = User::yesterdayReport()->get();
```

#### Hourly Report

[](#hourly-report)

```
/*Only Last hour to current hour's Users*/
$users = User::hourlyReport()->get();

// or

/*Only 7 am to 2pm Users*/

$from = '07:00'; // or Carbon time
$to = '14:00'; // or Carbon time
$users = User::hourlyReport($from, $to)->get();

// or

/*Only 7 am to 2pm at December 27, 2019 Users*/

$from = '07:00'; // or Carbon time
$to = '14:00'; // or Carbon time
$date = '2019-12-27'; // or Carbon date
$users = User::hourlyReport($from, $to, $date)->get();
```

### Custom Query

[](#custom-query)

You can implement your own conditions or do whatever you want with query.

```
$users = User::dailyReport()->where('status', '=', 'inactive')->get();
```

### Advanced Usage

[](#advanced-usage)

```
$data = [];

$date = Carbon::now()->firstOfMonth();
while ($date endOfMonth()) {
    $users = User::dailyReport($date)
        ->when('condition', function ($query) {
            $query->where('column', 'value');
        })
        ->whereNotIn('column', ['value1', 'value2'])
        ->where('column', 'operator', 'value')
        ->get();

    $data[] = $users;
    $date = $date->copy()->addDay();
}
```

License
-------

[](#license)

This is open-sourced laravel library licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~355 days

Total

2

Last Release

1978d ago

PHP version history (2 changes)v1.0.0PHP ^7.2

v1.2.0PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2816953f287ca302f12d59f94de4e90cd6cb5d2ba1f6eaa462045c2670969ea0?d=identicon)[paxha](/maintainers/paxha)

---

Top Contributors

[![paxha](https://avatars.githubusercontent.com/u/38579192?v=4)](https://github.com/paxha "paxha (10 commits)")

---

Tags

laravellaravel-packagereport-generatorreportablereportingreportslaravellaravel-packageLaravel Reportablereportablelaravel reportsreport generator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/paxha-laravel-reportable/health.svg)

```
[![Health](https://phpackages.com/badges/paxha-laravel-reportable/health.svg)](https://phpackages.com/packages/paxha-laravel-reportable)
```

###  Alternatives

[realrashid/sweet-alert

Laravel Sweet Alert Is A Package For Laravel Provides An Easy Way To Display Alert Messages Using The SweetAlert2 Library.

1.2k2.9M21](/packages/realrashid-sweet-alert)[imanghafoori/laravel-nullable

A package to help you write expressive defensive code in a functional manner

151423.7k6](/packages/imanghafoori-laravel-nullable)[djunehor/laravel-bible

Laravel package to fetch from the Holy Bible

182.8k](/packages/djunehor-laravel-bible)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
