<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use App\User;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class InsertController extends Controller {


    public function insert(Request $request){
    $email = $request->input('email');
    $un = $request->input('username');
    $ac = $request->input('account');
    $pw = $request->input('password');
    $lic = $request->input('license');
    $data=array('email'=>$email,"username"=>$un,"account"=>$ac,"password"=>$pw,"license"=>$lic);
    
    DB::table('ivy')->insert($data);
    // echo "<script>alert('註冊成功');parent.location.href='/'</script> ";

    return User::create([
        'name' => $un,
        'email' => $email,
        'password' => $pw,
    ]);
    
    }
}