PHP code example of houseoftech / laravel-recurring

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

    

houseoftech / laravel-recurring example snippets


Route::get('/', function () {
    $task = App\Task::first();

    $task->recurr()->first();

    $task->recurr()->last();

    $task->recurr()->next();

    $task->recurr()->current();

    $task->recurr()->rule();

    $task->recurr()->schedule();
});

    $task = new App\Task();

    $task->start_at = '2017/1/1';

    $task->until = '2017/12/12';

    $task->by_day = 'MO,FR';

    $task->frequency = 'WEEKLY';

    $task->timezone = 'Europe/Amsterdam';

    $start = new DateTime('2017/5/5');

    $end = new DateTime('2017/5/15');

    print_r($task->recurr()->scheduleBetween($start, $end));
	
	// Using exceptions and inclusions
	
	$task->exceptions = ['2017/05/08'];
	
	$task->inclusions = ['2017/05/10', '2017/05/11'];
	
	print_r($task->recurr()->scheduleBetween($start, $end));

	Schema::create('exceptions', function (Blueprint $table) {
		$table->increments('id');
		$table->integer('event_id')->unsigned();
		$table->datetime('date');
		$table->timestamps();
	});

	public function exceptions()
	{
		return $this->hasMany(Exception::class);
	}

	$task = App\Task::with('exceptions')->find(1);
	
	print_r($task->recurr()->schedule());
bash
$ php artisan vendor:publish