vendredi 9 août 2019

match input password with database hash password in laravel 5.1.45

i have problem in my code i'm trying to verify the input hash password from database. but i'm but uniformly not working. i had look into these related questions here and here and the source laravel. bas 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"),kindly if someone know can help me. thanks

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";
          }
         }
    }
    
    ?>


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire