29 lines
537 B
PHP
29 lines
537 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class ToDoList extends Model
|
|
{
|
|
protected $guarded = [];
|
|
|
|
public function path()
|
|
{
|
|
return '/to-do-lists/' . $this->id;
|
|
}
|
|
|
|
public function author(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function toDos(): HasMany
|
|
{
|
|
return $this->hasMany(ToDo::class);
|
|
}
|
|
}
|