Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Heres the code

<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Hash;
use Illuminate\Support\Facades\Auth;

class AdminController extends Controller
{
    public function dashboard(){
        return view ('admin.dashboard');
    }

    public function login(Request $request){
        // echo $password = Hash::make('123456');die;

        if($request->isMethod('post')){
            $data = $request->all();
            // echo"<pre>"; print_r($data); die;


            if(Auth::guard('admin')->attempt(['email'=>$data['email'], 'password'=>$data['password'],'status'=>1])){

                return redirect('admin/dashboard');

            }else{
                return redirect()->back()->with('error_mesage','password atau email anda salah');
            }
        }
        return view('admin.login');
    }

}


What I have tried:

double check the code,nothing error showed on console tab
Posted
Comments
Thava Rajan 19-Jul-22 20:34pm    
How did you define your admin guard

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900