Run this below command to create a Controller
php artisan make:controller TestController
This will create a TestController.php in your controller directory and copy the BOLD text to file created.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\DB;
class TestController extends Controller
{
public function ResetAdminPassword()
{
//Assume user id of admin is 1
$user_id=1;
$myNewPassword='P@ssword';
$password = Hash::make($myNewPassword);
DB::table('users')->where('id', '=', $user_id)->update([
'password' => $password
]);
}
}