app/Http/Controllers/userLoketController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id)
    {
        $valueFoto= '';
        if (!is_null($request->foto)) {
            $foto = $request->file('foto');
            $namafile = $foto->getClientOriginalName();
            $destinasi = 'image/fotoUser';
            $foto->move($destinasi,$namafile);
            $valueFoto = $namafile;
        }else {
            $fotoFile = $request->tampungFoto;
            $valueFoto = $fotoFile;
        }
        $model = userLoket::where('id',$id)->update([
            'name'=>$request->name,
            'loket_id'=>$request->loket_id,
            'foto'=>$valueFoto,
            'email'=> $request->email
        ]);
    }
public function update ( Request $ request , $ id ) { $ valueFoto = '' ; if ( ! is_null ( $ request -> foto ) ) { $ foto = $ request -> file ( 'foto' ) ; $ namafile = $ foto -> getClientOriginalName ( ) ; $ destinasi = 'image/fotoUser' ; $ foto -> move ( $ destinasi , $ namafile ) ; $ valueFoto = $ namafile ; } else { $ fotoFile = $ request -> tampungFoto ; $ valueFoto = $ fotoFile ; } $ model = userLoket :: where ( 'id' , $ id ) -> update ( [ 'name' => $ request -> name , 'loket_id' => $ request -> loket_id , 'foto' => $ valueFoto , 'email' => $ request -> email ] ) ; }
Update the specified resource in storage.
Update the specified resource in storage .