Add initial Todo items and CalDAV sync
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Todo extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
public $incrementing = false;
|
||||
protected $keyType = 'string';
|
||||
|
||||
// Wir verwalten created_at / last_modified manuell
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'etag',
|
||||
'title',
|
||||
'description',
|
||||
'type_id',
|
||||
'url',
|
||||
'due_date',
|
||||
'recurring',
|
||||
'priority',
|
||||
'status',
|
||||
'created_at',
|
||||
'last_modified',
|
||||
'parent',
|
||||
'object',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'due_date' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
'last_modified' => 'datetime',
|
||||
];
|
||||
|
||||
public function type()
|
||||
{
|
||||
return $this->belongsTo(TodoType::class, 'type_id');
|
||||
}
|
||||
|
||||
public function parentTodo()
|
||||
{
|
||||
return $this->belongsTo(self::class, 'parent');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(self::class, 'parent');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TodoType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['name'];
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
public function todos()
|
||||
{
|
||||
return $this->hasMany(Todo::class, 'type_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user