reminder for todos
This commit is contained in:
1 parent
f78740fbb0
commit
ec6d7e2a80
9 files changed
+171
-27
No files matched your search
+22
-9
@@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
#[Fillable('name', 'content', 'user_id', 'todoable_type', 'todoable_id', 'due_date', 'done_date', 'follow_up', 'review')]
|
||||
#[Fillable('name', 'content', 'user_id', 'todoable_type', 'todoable_id', 'due_date', 'done_date', 'follow_up', 'follow_up_notified_at', 'review')]
|
||||
#[ObservedBy([TodoObserver::class])]
|
||||
class Todo extends Model
|
||||
{
|
||||
@@ -23,15 +23,28 @@ class Todo extends Model
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function is_owner_or_assigned() {
|
||||
if(filament()->auth()->user()->id == $this->user_id) return true;
|
||||
if($this->todoable_type == Group::class && in_array(filament()->auth()->user()->id, $this->todoable()->first()->users()->get()->pluck('id')->toArray())) return true;
|
||||
if($this->todoable_type == User::class && $this->todoable()->first()->id == filament()->auth()->user()->id) return true;
|
||||
else return false;
|
||||
public function is_owner_or_assigned()
|
||||
{
|
||||
if (filament()->auth()->user()->id == $this->user_id) {
|
||||
return true;
|
||||
}
|
||||
if ($this->todoable_type == Group::class && in_array(filament()->auth()->user()->id, $this->todoable()->first()->users()->get()->pluck('id')->toArray())) {
|
||||
return true;
|
||||
}
|
||||
if ($this->todoable_type == User::class && $this->todoable()->first()->id == filament()->auth()->user()->id) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getassignetusers() {
|
||||
if($this->todoable_type == Group::class) return $this->todoable()->first()->users()->get();
|
||||
if($this->todoable_type == User::class) return [$this->todoable()->first()];
|
||||
public function getassignetusers()
|
||||
{
|
||||
if ($this->todoable_type == Group::class) {
|
||||
return $this->todoable()->first()->users()->get();
|
||||
}
|
||||
if ($this->todoable_type == User::class) {
|
||||
return [$this->todoable()->first()];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user