Compare commits
4 Commits
1559580ceb
...
cf2c953fab
| Author | SHA1 | Date | |
|---|---|---|---|
| cf2c953fab | |||
| 19a62578fb | |||
| e28ac7715b | |||
| 53ed08da45 |
@ -7,7 +7,6 @@ use App\Filament\Resources\Courses\Pages\EditCourse;
|
|||||||
use App\Filament\Resources\Courses\Pages\ListCourses;
|
use App\Filament\Resources\Courses\Pages\ListCourses;
|
||||||
use App\Filament\Resources\Courses\RelationManagers\KidsRelationManager;
|
use App\Filament\Resources\Courses\RelationManagers\KidsRelationManager;
|
||||||
use App\Filament\Resources\Courses\Schemas\CourseForm;
|
use App\Filament\Resources\Courses\Schemas\CourseForm;
|
||||||
use App\Filament\Resources\Courses\Schemas\CourseInfolist;
|
|
||||||
use App\Filament\Resources\Courses\Tables\CoursesTable;
|
use App\Filament\Resources\Courses\Tables\CoursesTable;
|
||||||
use App\Models\Course;
|
use App\Models\Course;
|
||||||
use BackedEnum;
|
use BackedEnum;
|
||||||
@ -23,7 +22,7 @@ class CourseResource extends Resource
|
|||||||
|
|
||||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::ArchiveBox;
|
protected static string|BackedEnum|null $navigationIcon = Heroicon::ArchiveBox;
|
||||||
|
|
||||||
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
|
protected static string|UnitEnum|null $navigationGroup = 'Kurse und Kinder';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'name';
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
@ -42,11 +41,6 @@ class CourseResource extends Resource
|
|||||||
return CourseForm::configure($schema);
|
return CourseForm::configure($schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function infolist(Schema $schema): Schema
|
|
||||||
{
|
|
||||||
return CourseInfolist::configure($schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function table(Table $table): Table
|
public static function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return CoursesTable::configure($table);
|
return CoursesTable::configure($table);
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\Courses\Schemas;
|
|
||||||
|
|
||||||
use Filament\Infolists\Components\TextEntry;
|
|
||||||
use Filament\Schemas\Schema;
|
|
||||||
|
|
||||||
class CourseInfolist
|
|
||||||
{
|
|
||||||
public static function configure(Schema $schema): Schema
|
|
||||||
{
|
|
||||||
return $schema
|
|
||||||
->components([
|
|
||||||
TextEntry::make('created_at')
|
|
||||||
->dateTime()
|
|
||||||
->placeholder('-'),
|
|
||||||
TextEntry::make('updated_at')
|
|
||||||
->dateTime()
|
|
||||||
->placeholder('-'),
|
|
||||||
TextEntry::make('name'),
|
|
||||||
TextEntry::make('duration')
|
|
||||||
->numeric(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -7,7 +7,6 @@ use App\Filament\Resources\Kids\Pages\EditKid;
|
|||||||
use App\Filament\Resources\Kids\Pages\ListKids;
|
use App\Filament\Resources\Kids\Pages\ListKids;
|
||||||
use App\Filament\Resources\Kids\RelationManagers\CoursesRelationManager;
|
use App\Filament\Resources\Kids\RelationManagers\CoursesRelationManager;
|
||||||
use App\Filament\Resources\Kids\Schemas\KidForm;
|
use App\Filament\Resources\Kids\Schemas\KidForm;
|
||||||
use App\Filament\Resources\Kids\Schemas\KidInfolist;
|
|
||||||
use App\Filament\Resources\Kids\Tables\KidsTable;
|
use App\Filament\Resources\Kids\Tables\KidsTable;
|
||||||
use App\Models\Kid;
|
use App\Models\Kid;
|
||||||
use BackedEnum;
|
use BackedEnum;
|
||||||
@ -23,7 +22,7 @@ class KidResource extends Resource
|
|||||||
|
|
||||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::UserCircle;
|
protected static string|BackedEnum|null $navigationIcon = Heroicon::UserCircle;
|
||||||
|
|
||||||
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
|
protected static string|UnitEnum|null $navigationGroup = 'Kurse und Kinder';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'name';
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
@ -42,11 +41,6 @@ class KidResource extends Resource
|
|||||||
return KidForm::configure($schema);
|
return KidForm::configure($schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function infolist(Schema $schema): Schema
|
|
||||||
{
|
|
||||||
return KidInfolist::configure($schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function table(Table $table): Table
|
public static function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return KidsTable::configure($table);
|
return KidsTable::configure($table);
|
||||||
|
|||||||
@ -12,7 +12,6 @@ use Filament\Actions\EditAction;
|
|||||||
use Filament\Actions\ViewAction;
|
use Filament\Actions\ViewAction;
|
||||||
use Filament\Forms\Components\DatePicker;
|
use Filament\Forms\Components\DatePicker;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Infolists\Components\TextEntry;
|
|
||||||
use Filament\Resources\RelationManagers\RelationManager;
|
use Filament\Resources\RelationManagers\RelationManager;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
@ -40,22 +39,6 @@ class CoursesRelationManager extends RelationManager
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function infolist(Schema $schema): Schema
|
|
||||||
{
|
|
||||||
return $schema
|
|
||||||
->components([
|
|
||||||
TextEntry::make('created_at')
|
|
||||||
->dateTime()
|
|
||||||
->placeholder('-'),
|
|
||||||
TextEntry::make('updated_at')
|
|
||||||
->dateTime()
|
|
||||||
->placeholder('-'),
|
|
||||||
TextEntry::make('name'),
|
|
||||||
TextEntry::make('duration')
|
|
||||||
->numeric(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function table(Table $table): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
|
|||||||
@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\Kids\Schemas;
|
|
||||||
|
|
||||||
use Filament\Infolists\Components\TextEntry;
|
|
||||||
use Filament\Schemas\Schema;
|
|
||||||
|
|
||||||
class KidInfolist
|
|
||||||
{
|
|
||||||
public static function configure(Schema $schema): Schema
|
|
||||||
{
|
|
||||||
return $schema
|
|
||||||
->components([
|
|
||||||
TextEntry::make('created_at')
|
|
||||||
->dateTime()
|
|
||||||
->placeholder('-'),
|
|
||||||
TextEntry::make('updated_at')
|
|
||||||
->dateTime()
|
|
||||||
->placeholder('-'),
|
|
||||||
TextEntry::make('name'),
|
|
||||||
TextEntry::make('email')
|
|
||||||
->label('Email address')
|
|
||||||
->placeholder('-'),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
11
app/Filament/Resources/Todos/Pages/CreateTodo.php
Normal file
11
app/Filament/Resources/Todos/Pages/CreateTodo.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Todos\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Todos\TodoResource;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateTodo extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = TodoResource::class;
|
||||||
|
}
|
||||||
19
app/Filament/Resources/Todos/Pages/EditTodo.php
Normal file
19
app/Filament/Resources/Todos/Pages/EditTodo.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Todos\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Todos\TodoResource;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditTodo extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = TodoResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
19
app/Filament/Resources/Todos/Pages/ListTodos.php
Normal file
19
app/Filament/Resources/Todos/Pages/ListTodos.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Todos\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Todos\TodoResource;
|
||||||
|
use Filament\Actions\CreateAction;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListTodos extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = TodoResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
49
app/Filament/Resources/Todos/Schemas/TodoForm.php
Normal file
49
app/Filament/Resources/Todos/Schemas/TodoForm.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Todos\Schemas;
|
||||||
|
|
||||||
|
use App\Models\Group;
|
||||||
|
use App\Models\User;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
public static function configure(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return $schema
|
||||||
|
->components([
|
||||||
|
TextInput::make('name')
|
||||||
|
->label('Titel')
|
||||||
|
->required(),
|
||||||
|
Select::make('user.name')->relationship('user', 'name')->label('Benutzer')->hiddenOn(['create'])->disabledOn(['edit']),
|
||||||
|
Hidden::make('user_id')->default(filament()->auth()->user()->id),
|
||||||
|
RichEditor::make('content')
|
||||||
|
->label('Todo')
|
||||||
|
->columnSpanFull(),
|
||||||
|
MorphToSelect::make('todoable')
|
||||||
|
->types([
|
||||||
|
MorphToSelect\Type::make(User::class)->label('Benutzer')->titleAttribute('name'),
|
||||||
|
MorphToSelect\Type::make(Group::class)->label('Gruppe')->titleAttribute('name'),
|
||||||
|
])
|
||||||
|
->label('zugeordnet'),
|
||||||
|
Section::make()->components([
|
||||||
|
DatePicker::make('due_date')->label('Todo-Datum'),
|
||||||
|
Toggle::make('review')->label('Review')->hint('Todo geht nach Erledigung noch mal zum Ersteller'),
|
||||||
|
|
||||||
|
]),
|
||||||
|
DatePicker::make('follow_up')->label('Wiedervorlage/Erinnerung'),
|
||||||
|
DatePicker::make('done_date')->label('Erledigt am')->hiddenOn(['create']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
57
app/Filament/Resources/Todos/Tables/TodosTable.php
Normal file
57
app/Filament/Resources/Todos/Tables/TodosTable.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Todos\Tables;
|
||||||
|
|
||||||
|
use Filament\Actions\BulkActionGroup;
|
||||||
|
use Filament\Actions\DeleteBulkAction;
|
||||||
|
use Filament\Actions\EditAction;
|
||||||
|
use Filament\Tables\Columns\IconColumn;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
|
class TodosTable
|
||||||
|
{
|
||||||
|
public static function configure(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('created_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
TextColumn::make('updated_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
TextColumn::make('name')
|
||||||
|
->searchable(),
|
||||||
|
TextColumn::make('user.name')
|
||||||
|
->searchable(),
|
||||||
|
TextColumn::make('todoable.name')
|
||||||
|
->label('Zugewiesen')
|
||||||
|
->searchable(),
|
||||||
|
TextColumn::make('due_date')
|
||||||
|
->date()
|
||||||
|
->sortable(),
|
||||||
|
TextColumn::make('done_date')
|
||||||
|
->date()
|
||||||
|
->sortable(),
|
||||||
|
TextColumn::make('follow_up')
|
||||||
|
->date()
|
||||||
|
->sortable(),
|
||||||
|
IconColumn::make('review')
|
||||||
|
->boolean(),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
//
|
||||||
|
])
|
||||||
|
->recordActions([
|
||||||
|
EditAction::make(),
|
||||||
|
])
|
||||||
|
->toolbarActions([
|
||||||
|
BulkActionGroup::make([
|
||||||
|
DeleteBulkAction::make(),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
50
app/Filament/Resources/Todos/TodoResource.php
Normal file
50
app/Filament/Resources/Todos/TodoResource.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Todos;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Todos\Pages\CreateTodo;
|
||||||
|
use App\Filament\Resources\Todos\Pages\EditTodo;
|
||||||
|
use App\Filament\Resources\Todos\Pages\ListTodos;
|
||||||
|
use App\Filament\Resources\Todos\Schemas\TodoForm;
|
||||||
|
use App\Filament\Resources\Todos\Tables\TodosTable;
|
||||||
|
use App\Models\Todo;
|
||||||
|
use BackedEnum;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
use Filament\Support\Icons\Heroicon;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
|
class TodoResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = Todo::class;
|
||||||
|
|
||||||
|
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||||
|
|
||||||
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
|
public static function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return TodoForm::configure($schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return TodosTable::configure($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => ListTodos::route('/'),
|
||||||
|
'create' => CreateTodo::route('/create'),
|
||||||
|
'edit' => EditTodo::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\Users\Schemas;
|
|
||||||
|
|
||||||
use Filament\Infolists\Components\TextEntry;
|
|
||||||
use Filament\Schemas\Schema;
|
|
||||||
|
|
||||||
class UserInfolist
|
|
||||||
{
|
|
||||||
public static function configure(Schema $schema): Schema
|
|
||||||
{
|
|
||||||
return $schema
|
|
||||||
->components([
|
|
||||||
TextEntry::make('name'),
|
|
||||||
TextEntry::make('email')
|
|
||||||
->label('Email address'),
|
|
||||||
TextEntry::make('groups.title')
|
|
||||||
->label('Gruppen'),
|
|
||||||
TextEntry::make('roles.title')
|
|
||||||
->label('Rollen'),
|
|
||||||
TextEntry::make('email_verified_at')
|
|
||||||
->dateTime()
|
|
||||||
->placeholder('-'),
|
|
||||||
TextEntry::make('created_at')
|
|
||||||
->dateTime()
|
|
||||||
->placeholder('-'),
|
|
||||||
TextEntry::make('updated_at')
|
|
||||||
->dateTime()
|
|
||||||
->placeholder('-'),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -6,7 +6,6 @@ use App\Filament\Resources\Users\Pages\CreateUser;
|
|||||||
use App\Filament\Resources\Users\Pages\EditUser;
|
use App\Filament\Resources\Users\Pages\EditUser;
|
||||||
use App\Filament\Resources\Users\Pages\ListUsers;
|
use App\Filament\Resources\Users\Pages\ListUsers;
|
||||||
use App\Filament\Resources\Users\Schemas\UserForm;
|
use App\Filament\Resources\Users\Schemas\UserForm;
|
||||||
use App\Filament\Resources\Users\Schemas\UserInfolist;
|
|
||||||
use App\Filament\Resources\Users\Tables\UsersTable;
|
use App\Filament\Resources\Users\Tables\UsersTable;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use BackedEnum;
|
use BackedEnum;
|
||||||
@ -37,11 +36,6 @@ class UserResource extends Resource
|
|||||||
return UserForm::configure($schema);
|
return UserForm::configure($schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function infolist(Schema $schema): Schema
|
|
||||||
{
|
|
||||||
return UserInfolist::configure($schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function table(Table $table): Table
|
public static function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return UsersTable::configure($table);
|
return UsersTable::configure($table);
|
||||||
|
|||||||
23
app/Models/Todo.php
Normal file
23
app/Models/Todo.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
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')]
|
||||||
|
class Todo extends Model
|
||||||
|
{
|
||||||
|
public function todoable(): MorphTo
|
||||||
|
{
|
||||||
|
return $this->morphTo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user(): BelongsTo {
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -11,6 +11,7 @@ use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|||||||
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
|
||||||
@ -49,6 +50,11 @@ class User extends Authenticatable implements FilamentUser
|
|||||||
return $this->belongsToMany(Group::class);
|
return $this->belongsToMany(Group::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function todos(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(Todo::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function hasRole(string $role): bool
|
public function hasRole(string $role): bool
|
||||||
{
|
{
|
||||||
return in_array($role, $this->roles()->pluck('name')->toArray());
|
return in_array($role, $this->roles()->pluck('name')->toArray());
|
||||||
|
|||||||
37
database/migrations/2026_06_02_171154_create_todos_table.php
Normal file
37
database/migrations/2026_06_02_171154_create_todos_table.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('todos', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->timestamps();
|
||||||
|
$table->string('name');
|
||||||
|
$table->text('content')->nullable();
|
||||||
|
$table->foreignIdFor(User::class);
|
||||||
|
$table->string('todoable_type')->nullable();
|
||||||
|
$table->integer('todoable_id')->nullable();
|
||||||
|
$table->date('due_date')->nullable();
|
||||||
|
$table->date('done_date')->nullable();
|
||||||
|
$table->date('follow_up')->nullable();
|
||||||
|
$table->boolean('review')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('todos');
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user