Compare commits

..

No commits in common. "1383cad8b96ad2eb80101b57c801e849a338461f" and "727fcff6418269317b03c46040dd47be55948837" have entirely different histories.

4 changed files with 2 additions and 125 deletions

View File

@ -1,38 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class UserController extends Controller
{
public function index()
{
$users = User::all();
return view('users.index', compact('users'));
}
public function store($request)
{
if (Auth::guest()) {
return redirect()->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');
}
}

View File

@ -3,7 +3,6 @@
namespace Database\Seeders; namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents; // use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Models\User;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder class DatabaseSeeder extends Seeder

View File

@ -1,75 +0,0 @@
<h2>список пользователей</h2>
<a href="{{ route('users.create') }}"> создать пользователя</a>
<br>
<br>
<table class="mt-4">
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
<tr>
<th>id</th>
<td>name</td>
<td>email</td>
</tr>
</thead>
<tbody>
@foreach($users as $user)
<tr>
<td>{{ $user->id }}</td>
<td>{{ $user->name }}</td>
<td>{{ $user->email }}</td>
</tr>
@endforeach
</tbody>
</table>
{{--<table class="mt-4">--}}
{{-- <thead class="border-b-2 border-solid border-black text-left" style="text-align: left">--}}
{{-- <tr>--}}
{{-- <th>{{ __('layout.table_id') }}</th>--}}
{{-- <th>{{ __('layout.table_task_status') }}</th>--}}
{{-- <th>{{ __('layout.table_name') }}</th>--}}
{{-- <th>{{ __('layout.table_creater') }}</th>--}}
{{-- <th>{{ __('layout.table_assigned') }}</th>--}}
{{-- <th>{{ __('layout.table_date_of_creation') }}</th>--}}
{{-- @auth()--}}
{{-- <th>{{ __('layout.table_actions') }}</th>--}}
{{-- @endauth--}}
{{-- </tr>--}}
{{-- </thead>--}}
{{-- <tbody>--}}
{{-- @foreach($tasks as $task)--}}
{{-- <tr class="border-b border-dashed text-left">--}}
{{-- <td>{{ $task->id }}</td>--}}
{{-- <td>{{ $taskStatuses[$task->status_id] }}</td>--}}
{{-- <td><a href="{{ route('tasks.show', $task) }}">{{ $task->name }}</a></td>--}}
{{-- <td>{{ $users[$task->created_by_id] }}</td>--}}
{{-- <td>{{ $users[$task->assigned_to_id] }}</td>--}}
{{-- <td>{{ date_format($task->created_at, 'd.m.Y') }}</td>--}}
{{-- @auth()--}}
{{-- <td>--}}
{{-- @can('delete', $task)--}}
{{-- <a--}}
{{-- class="text-red-600 hover:text-red-900"--}}
{{-- rel="nofollow"--}}
{{-- data-method="delete"--}}
{{-- data-confirm="{{ __('layout.table_delete_question') }}"--}}
{{-- href="{{ route('tasks.destroy', $task) }}"--}}
{{-- >--}}
{{-- {{ __('layout.table_delete') }}--}}
{{-- </a>--}}
{{-- @endcan--}}
{{-- @can('update', $task)--}}
{{-- <a class="text-blue-600 hover:text-blue-900"--}}
{{-- href="{{ route("tasks.edit", $task) }}"--}}
{{-- >--}}
{{-- {{ __('layout.table_edit') }}--}}
{{-- </a>--}}
{{-- @endcan--}}
{{-- </td>--}}
{{-- @endauth--}}
{{-- </tr>--}}
{{-- @endforeach--}}
{{-- </tbody>--}}
{{--</table>--}}

View File

@ -1,7 +1,6 @@
<?php <?php
use App\Http\Controllers\ProfileController; use App\Http\Controllers\ProfileController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
/* /*
@ -17,19 +16,11 @@ use Illuminate\Support\Facades\Route;
Route::get('/', function () { Route::get('/', function () {
return view('welcome'); return view('welcome');
})->name('home'); });
Route::get('test', function () {
Route::resource('/users', UserController::class);
Route::get('/test', function () {
return view('test'); return view('test');
}); });
Route::get('/dashboard', function () {
return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');
Route::get('/dashboard', function () { Route::get('/dashboard', function () {
return view('dashboard'); return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard'); })->middleware(['auth', 'verified'])->name('dashboard');