git add .
git commit "Add admin management search sort and permission structure preparation"
This commit is contained in:
@@ -2,17 +2,37 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin\Auth;
|
||||
|
||||
use App\Enums\AdminStatus;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\Admin\Auth\LoginPostRequest;
|
||||
use App\Models\Admin;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
public function login()
|
||||
{
|
||||
return view('admin.auth.login');
|
||||
$rawLayout = true;
|
||||
$title='ورود به حساب کاربری';
|
||||
return view('admin.auth.login',compact('rawLayout','title'));
|
||||
}
|
||||
public function loginPost()
|
||||
public function loginPost(LoginPostRequest $request)
|
||||
{
|
||||
$loginData=$request->validated();
|
||||
|
||||
$admins=Admin::query()
|
||||
->where('username',$request->input('username'))
|
||||
->where('status',AdminStatus::Active)
|
||||
->first();
|
||||
|
||||
if (!$admins){
|
||||
return back()->withErrors([
|
||||
'general' => 'اطلاعات وارد شده نامعتبر است'
|
||||
]);
|
||||
}
|
||||
|
||||
Auth::guard('admin')->login($admins);
|
||||
return redirect()->route('admin.dashboard.index');
|
||||
|
||||
}
|
||||
public function logout()
|
||||
|
||||
@@ -3,8 +3,25 @@
|
||||
namespace App\Http\Controllers\Admin\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Admin;
|
||||
use App\Models\Flight;
|
||||
use App\Models\Tour;
|
||||
use App\Models\User;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
//
|
||||
public function index()
|
||||
{
|
||||
$adminsCount = Admin::count();
|
||||
|
||||
$usersCount = User::count();
|
||||
|
||||
$toursCount = Tour::count();
|
||||
|
||||
$flightsCount = Flight::count();
|
||||
|
||||
return view('admin.dashboard',compact('adminsCount',
|
||||
'usersCount','toursCount','flightsCount'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user