app/Http/Controllers/ClientController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Client  $client
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, Client $client)
    {
        $client->name = $request->name;
        $client->tele = $request->tele;
        $client->asrn = $request->asrn; 
        $client->dateDubet = $request->dateD;
        if($request->hasFile('image')){
            $image = $request->image;
            $image_new_name = time() . '.' . $image->getClientOriginalExtension();
            $image->move('storage/post/', $image_new_name);
            $client->image = '/storage/post/' . $image_new_name;
        }
        $client->save();
        return redirect()->back();
    }
public function update ( Request $ request , Client $ client ) { $ client -> name = $ request -> name ; $ client -> tele = $ request -> tele ; $ client -> asrn = $ request -> asrn ; $ client -> dateDubet = $ request -> dateD ; if ( $ request -> hasFile ( 'image' ) ) { $ image = $ request -> image ; $ image_new_name = time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'storage/post/' , $ image_new_name ) ; $ client -> image = '/storage/post/' . $ image_new_name ; } $ client -> save ( ) ; return redirect ( ) -> back ( ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
// Session::flash('success', 'Post updated successfully');