PHP code example of joaorbrandao / laravel-intervals

1. Go to this page and download the library: Download joaorbrandao/laravel-intervals 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/ */

    

joaorbrandao / laravel-intervals example snippets


php artisan vendor:publish --provider=Joaorbrandao\LaravelIntervals\LaravelIntervalsServiceProvider

php artisan make:interval FirstDayOfLastWeek



namespace App\LaravelIntervals;


use Joaorbrandao\LaravelIntervals\Contracts\Interval;

final class FirstDayOfLastWeek implements Interval
{
    public function resolve()
    {
        return [
            'start' => now()->subWeek()->startOfWeek()->startOfday(),
            'end' => now()->subWeek()->startOfWeek()->endOfDay(),
            'enabled' => true,
            'id' => 'firstDayOfLastWeek',
            'name' => 'first_day_of_last_week',
        ];
    }
}

LaravelIntervals::last365Days();

// Return
Joaorbrandao\LaravelIntervals\Interval^ {#382
    +end: Illuminate\Support\Carbon @1571693543^ {#767
        date: 2019-10-21 21:32:23.050513 UTC (+00:00)
    }
    +id: "last365Days"
    +name: "last_65_days"
    +start: Illuminate\Support\Carbon @1540157543^ {#768
        date: 2018-10-21 21:32:23.050440 UTC (+00:00)
    } 
}