28 lines
610 B
PHP
28 lines
610 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class CalendarInstance extends Model
|
|
{
|
|
protected $table = 'calendarinstances';
|
|
public $timestamps = false;
|
|
|
|
public function calendar(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Calendar::class, 'calendarid');
|
|
}
|
|
|
|
public function caldavUrl(): string
|
|
{
|
|
// e.g. https://kithkin.lan/dav/calendars/1/48f888f3-c5c5-…/
|
|
return url(
|
|
'/dav/calendars/' .
|
|
auth()->id() . '/' .
|
|
$this->uri . '/'
|
|
);
|
|
}
|
|
}
|