<?php

namespace App\Http\Controllers;

use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class AuthController extends Controller
{

    function login(Request $request)
    {
        if ($request->isMethod('POST')) {
            $mobile = $request->mobile;

            $user = User::where('mobile', $mobile)->first();
            if ($user) {
                Auth::login($user);

                return redirect()->route('index');
            } else {
                echo "YONGHU NO";
            }
        } else {
//            return view('auth.login');
        }
    }

}
