<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Student;
use Illuminate\Support\Facades\DB;
class UserController extends Controller
{
public function index(){
$users=DB::table('users')->where('id','>',1)->get();
dd($users);
}
public function show($id){
$users=DB::table('users')->find(1);
dd($users);
}
public function showSome(){
$name='老师';
return view('admin.login')->with('name',$name)->with('age',31);
}
public function create(){
$res=DB::insert('insert into users(name,email,password) value(?,?,?)',['殷素素','yin@qq.com','123']);
dd($res);
}
public function store(Request $request){
$data=$request->except("_token");
return view('store',compact('data'));
}
public function edit($id)
{
}
public function login(){
return view('login');
}
public function loginCheck(Request $request){
$data=$request->all();
$username=$request->input('username');
$password=$request->input('password');
$res=DB::table('users')->where('name',$username)->where('password',$password)->first();
if($res){
echo "登录成功!";
}else{
echo "登录失败!";
}
}
}
?>
|