0

i have problem in my code i'm trying to verify the input hash password from database. but uniformly not working with me. i had look into these related questions here and here and the source laravel. and the error given to me

( ErrorException in loginController.php line 19: Non-static method Illuminate\Http\Request::input() should not be called statically, assuming $this from incompatible context")

code here

       <?php
    namespace App\Http\Controllers;
    use Illuminate\Foundation\Bus\DispatchesJobs;
    use Illuminate\Http\Request;
    use Illuminate\Routing\Controller as BaseController;
    use Illuminate\Foundation\Validation\ValidatesRequests;
    use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
    use Illuminate\Foundation\Auth\Access\AuthorizesResources;
    use DB;
    use Hash;
    
    class loginController extends BaseController
    {
         public function login(Request $req)
         {
          $username = $req->input('username');
          //$password = $req->Hash::check(input('password'));
          $password['password']= Hash::make(Request::input('password'));
    
          $checkLogin = DB::table('users')->where(['username'=>$username,'password'=>$password])->get();
          if(count($checkLogin)  >0)
          {
           echo "Login SuccessFull<br/>";;
          }
          else
          {
           echo "Login Faield Wrong Data Passed";
          }
         }
    }
    
    ?>

1 Answers1

0

As the error states you are trying to call a non static method statically.

replace:

$password['password']= Hash::make(Request::input('password'));

with:

$password = Hash::make($req->input('password'));
Remul
  • 7,874
  • 1
  • 13
  • 30
  • thx sir, i have trying to pass md5 hashing password (21232f297a57a5a743894a0e4a801fc3) as "admin" but its give me Login Faield Wrong Data Passed ? dose i missed something? – John David Aug 10 '19 at 05:30
  • any suggestion to read the md5 password store in mysql in laravel?? – John David Aug 11 '19 at 09:27