forked from aslan/applicant-site
prodV1 #2
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
namespace App\Http\Controllers\admin;
|
||||
|
||||
use App\Http\Requests\UpdateUserRequest;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\admin\UpdateUserRequest;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Events\PasswordReset;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Foundation\Application;
|
||||
|
@ -15,16 +15,12 @@ use Illuminate\Support\Str;
|
|||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
|
||||
{
|
||||
abort_if(Auth::user()->name !== 'admin', 403);
|
||||
|
||||
$users = User::all();
|
||||
return view('users.index', compact('users'));
|
||||
return view('admin.users.index', compact('users'));
|
||||
}
|
||||
|
||||
public function store(UpdateUserRequest $request): RedirectResponse
|
||||
|
@ -46,14 +42,14 @@ class UserController extends Controller
|
|||
{
|
||||
abort_if(Auth::user()->name !== 'admin', 403);
|
||||
|
||||
return view('users.create');
|
||||
return view('admin.users.create');
|
||||
}
|
||||
|
||||
public function edit(User $user): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
|
||||
{
|
||||
abort_if(Auth::user()->name !== 'admin', 403);
|
||||
|
||||
return view('users.edit', compact('user'));
|
||||
return view('admin.users.edit', compact('user'));
|
||||
}
|
||||
|
||||
public function update(UpdateUserRequest $request, User $user): RedirectResponse
|
Loading…
Reference in New Issue