diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php new file mode 100644 index 0000000..495fd26 --- /dev/null +++ b/app/Http/Controllers/UserController.php @@ -0,0 +1,38 @@ +route('tasks.index'); + } + + $validated = $request->validated(); + $createdById = Auth::id(); + $data = [...$validated, 'created_by_id' => $createdById]; + + $task = new User(); + $task->fill($data); + $task->save(); + + if (array_key_exists('labels', $validated)) { + $task->labels()->attach($validated['labels']); + } + + $message = __('controllers.tasks_create'); + return redirect()->route('tasks.index'); + } +} diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index a9f4519..e4705bd 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -3,6 +3,7 @@ namespace Database\Seeders; // use Illuminate\Database\Console\Seeds\WithoutModelEvents; +use App\Models\User; use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder diff --git a/resources/views/users/index.blade.php b/resources/views/users/index.blade.php new file mode 100644 index 0000000..3acc6e1 --- /dev/null +++ b/resources/views/users/index.blade.php @@ -0,0 +1,75 @@ +
id | +name | +|
---|---|---|
{{ $user->id }} | +{{ $user->name }} | +{{ $user->email }} | +
{{ __('layout.table_id') }} | --}} +{{--{{ __('layout.table_task_status') }} | --}} +{{--{{ __('layout.table_name') }} | --}} +{{--{{ __('layout.table_creater') }} | --}} +{{--{{ __('layout.table_assigned') }} | --}} +{{--{{ __('layout.table_date_of_creation') }} | --}} +{{-- @auth()--}} +{{--{{ __('layout.table_actions') }} | --}} +{{-- @endauth--}} +{{--
---|---|---|---|---|---|---|
{{ $task->id }} | --}} +{{--{{ $taskStatuses[$task->status_id] }} | --}} +{{--{{ $task->name }} | --}} +{{--{{ $users[$task->created_by_id] }} | --}} +{{--{{ $users[$task->assigned_to_id] }} | --}} +{{--{{ date_format($task->created_at, 'd.m.Y') }} | --}} +{{-- @auth()--}} +{{----}}
+{{-- @can('delete', $task)--}}
+{{-- | --}}
+{{-- @endauth--}}
+{{--