first commit
This commit is contained in:
31
app/Http/Controllers/Admin/DashboardController.php
Normal file
31
app/Http/Controllers/Admin/DashboardController.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('admin.home');
|
||||
}
|
||||
}
|
||||
30
app/Http/Controllers/Admin/ProfileController.php
Normal file
30
app/Http/Controllers/Admin/ProfileController.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use App\Http\Requests\ProfileUpdateRequest;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
public function show()
|
||||
{
|
||||
return view('auth.profile');
|
||||
}
|
||||
|
||||
public function update(ProfileUpdateRequest $request)
|
||||
{
|
||||
if ($request->password) {
|
||||
auth()->user()->update(['password' => Hash::make($request->password)]);
|
||||
}
|
||||
|
||||
auth()->user()->update([
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('success', 'Profile updated.');
|
||||
}
|
||||
}
|
||||
17
app/Http/Controllers/Admin/UserController.php
Normal file
17
app/Http/Controllers/Admin/UserController.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$users = User::paginate();
|
||||
|
||||
return view('admin.users.index', compact('users'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user