PHP code example of boysfromthefactory / groundhog
1. Go to this page and download the library: Download boysfromthefactory/groundhog 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/ */
boysfromthefactory / groundhog example snippets
return [
// ISO-8601 duration: how far an infinite rule is expanded after the query's lower start
// bound (or after now) when the query gives no upper bound.
'horizon' => 'P1Y',
// Most occurrences one series may generate for one query (or on save); more fails with
// OccurrenceLimitExceeded.
'max_occurrences_per_series' => 50000,
];
use BoysFromTheFactory\Groundhog\Concerns\HasRecurrence;
use Illuminate\Database\Eloquent\Model;
class Meeting extends Model
{
use HasRecurrence;
// Only needed when your columns are named differently (defaults shown).
public const RECURRENCE_STARTS_AT = 'starts_at';
public const RECURRENCE_ENDS_AT = 'ends_at'; // null when the model has no end column
protected $fillable = ['title', 'starts_at', 'ends_at', 'recurrence_rule'];
}
$occurrence->isVirtualOccurrence(); // true
$occurrence->series; // the stored series record
$occurrence->originalOccurrenceStart(); // the start the rule generated
$occurrence->update(['location' => 'Room B']); // stored as an exception of this occurrence only
$occurrence->delete(); // cancels this occurrence; nothing is stored