<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Models\Admin;
use Session;
class AccountSettingController extends Controller
{
    function changePassword(){
        $result = $this->getUserDetails();
        return view('/change-password',['data'=>$result]);
    }
    function updatePassword(Request $req){
        $data = Admin::find($req->UserId);

        if($req->OldPassword == $req->PrevPass){
        $data->Password = $req->AdminPassword;
        $data->save();
        return 1;
        }
        else{
            return 0;
        }
    }
    function getUserDetails(){
        $UserId = 19;
        $result = Admin::select()->where(['id'=>$UserId])->get();
        return $result;
    }
}
