Laravel Create and Check Password using Lumen
In this tutorial, we will learn Laravel Create and Check Password using Lumen. We will explain Laravel package lumen/lumen to create and check passwords. We use the Laravel package lumen to create passwords and check password functionality. Laravel/Lumen use with a Hash facade that provides the secure Bcrypt & Argon2 hashing for storing user string passwords. Laravel default provides Login & Register Controllers uses Bcrypt for authentication. Also, we provide Laravel Eloquent union() Query.
I would like to share Laravel create and check passwords using Lumen Example. In this tutorial, you will learn how to create and check passwords using Lumen Laravel. And if you want to see an example of how to create a password and check functionality, then you are in the right place.
<?php namespace App\Http\Controllers; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use App\Models\User; use Hash; class UserController extends Controller { public function update(Request $request) { $request->user()->fill([ 'password' => Hash::make($request->newPassword) ])->save(); } public function check(Request $request) { $user = User::where('email', '=', 'devnote16@email.com')->first(); if ($user) { if (Hash::check($request->password, $user->password) { //unauthenticated return ['error' => 'unauthenticated user']; } } return []; } }