app/Http/Controllers/DriverController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Driver  $driver
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, Driver $driver)
    {
        $this->validate($request, [
            'nik' => 'required|size:12|unique:drivers,nik,'.$driver->id,
            'nama' => 'required',
            'tempat_lahir' => 'required',
            'tanggal_lahir' => 'required',
            'jenis_kelamin' => 'required',
            'alamat' => 'required',
            'no_tlp' => 'required'
        ]);
        Driver::where('id', $driver->id)->update([
            'nik' => $request->nik,
            'nama' => $request->nama,
            'tempat_lahir' => $request->tempat_lahir,
            'tanggal_lahir' => $request->tanggal_lahir,
            'jenis_kelamin' => $request->jenis_kelamin,
            'alamat' => $request->alamat,
            'no_tlp' => $request->no_tlp
        ]);
        return redirect()->route('driver.index');
    }
public function update ( Request $ request , Driver $ driver ) { $ this -> validate ( $ request , [ 'nik' => 'required|size:12|unique:drivers,nik,' . $ driver -> id , 'nama' => 'required' , 'tempat_lahir' => 'required' , 'tanggal_lahir' => 'required' , 'jenis_kelamin' => 'required' , 'alamat' => 'required' , 'no_tlp' => 'required' ] ) ; Driver :: where ( 'id' , $ driver -> id ) -> update ( [ 'nik' => $ request -> nik , 'nama' => $ request -> nama , 'tempat_lahir' => $ request -> tempat_lahir , 'tanggal_lahir' => $ request -> tanggal_lahir , 'jenis_kelamin' => $ request -> jenis_kelamin , 'alamat' => $ request -> alamat , 'no_tlp' => $ request -> no_tlp ] ) ; return redirect ( ) -> route ( 'driver.index' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .