Compare commits
2 Commits
cf2c953fab
...
b59bea841a
| Author | SHA1 | Date | |
|---|---|---|---|
| b59bea841a | |||
| ed2d4c6183 |
@ -8,14 +8,11 @@ use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\MorphToSelect;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\RichEditor\RichEditorTool;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Random\Engine\Secure;
|
||||
|
||||
class TodoForm
|
||||
{
|
||||
|
||||
@ -28,7 +28,7 @@ class TodosTable
|
||||
TextColumn::make('user.name')
|
||||
->searchable(),
|
||||
TextColumn::make('todoable.name')
|
||||
->label('Zugewiesen')
|
||||
->label('Zugewiesen')
|
||||
->searchable(),
|
||||
TextColumn::make('due_date')
|
||||
->date()
|
||||
|
||||
@ -2,13 +2,14 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Observers\TodoObserver;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Override;
|
||||
|
||||
#[Fillable('name', 'content', 'user_id', 'todoable_type', 'todoable_id', 'due_date', 'done_date', 'follow_up', 'review')]
|
||||
#[ObservedBy([TodoObserver::class])]
|
||||
class Todo extends Model
|
||||
{
|
||||
public function todoable(): MorphTo
|
||||
@ -16,8 +17,8 @@ class Todo extends Model
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
public function user(): BelongsTo {
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
48
app/Observers/TodoObserver.php
Normal file
48
app/Observers/TodoObserver.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\Todo;
|
||||
|
||||
class TodoObserver
|
||||
{
|
||||
/**
|
||||
* Handle the Todo "created" event.
|
||||
*/
|
||||
public function created(Todo $todo): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Todo "updated" event.
|
||||
*/
|
||||
public function updated(Todo $todo): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Todo "deleted" event.
|
||||
*/
|
||||
public function deleted(Todo $todo): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Todo "restored" event.
|
||||
*/
|
||||
public function restored(Todo $todo): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Todo "force deleted" event.
|
||||
*/
|
||||
public function forceDeleted(Todo $todo): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user