first work on To Do Lists
This commit is contained in:
28
app/Models/ToDoList.php
Normal file
28
app/Models/ToDoList.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\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 users(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function toDos(): HasMany
|
||||
{
|
||||
return $this->hasMany(ToDo::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user