39 lines
		
	
	
		
			885 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			885 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Models;
 | 
						|
 | 
						|
use Illuminate\Database\Eloquent\Model;
 | 
						|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
 | 
						|
use Illuminate\Database\Eloquent\Relations\HasOne;
 | 
						|
 | 
						|
class Event extends Model
 | 
						|
{
 | 
						|
    protected $table = 'calendarobjects'; // Sabre table
 | 
						|
    public $timestamps = false;
 | 
						|
    protected $primaryKey = 'id';
 | 
						|
 | 
						|
    /* add mass-assignment for these cols */
 | 
						|
    protected $fillable = [
 | 
						|
        'calendarid',
 | 
						|
        'uri',
 | 
						|
        'lastmodified',
 | 
						|
        'etag',
 | 
						|
        'size',
 | 
						|
        'componenttype',
 | 
						|
        'uid',
 | 
						|
        'calendardata',
 | 
						|
    ];
 | 
						|
 | 
						|
    /* owning calendar */
 | 
						|
    public function calendar(): BelongsTo
 | 
						|
    {
 | 
						|
        return $this->belongsTo(Calendar::class, 'calendarid');
 | 
						|
    }
 | 
						|
 | 
						|
    /* ui-specific metadata (category, reminders, extra json) */
 | 
						|
    public function meta(): HasOne
 | 
						|
    {
 | 
						|
        return $this->hasOne(EventMeta::class, 'event_id');
 | 
						|
    }
 | 
						|
}
 |