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


    public function insert(Request $request){
       
        $data=array(
            'name'=>$request->input('name'),
            "age"=>$request->input('age'),
            "sex"=>$request->input('sex'),
            "work"=>$request->input('work'),
            "phone"=>$request->input('phone')
        );
        
        People::insert($data);
        return redirect('people');
       
    }
    public function delete (Request $request){
    
        People::where('id',$request->input('delete'))->delete();
        return redirect('people');
    }
    public function update (Request $request){
    $id = $request->input('id1');  
    $name = $request->input('name1');
    $age = $request->input('age1');
    $sex= $request->input('sex1');
    $work= $request->input('work1');
    $phone = $request->input('phone1');
   
    People::where('id',$request->input('id1'))->update(['name' =>$name,'age' => $age,'sex' => $sex,'work' => $work,'phone' => $phone]);
    
    return redirect('people');


       

    }
       
}