app/Http/Controllers/SliderController.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)
    {
        $this->validateWith([
            'slider_title' => 'required',
        ]);
        $img = $request->file('image');
        if($img){
        $ffname = 'feat-' . str_slug( $request->blog_title ) . '-' . str_random(8) . '.' . $img->getClientOriginalExtension();
        Image::make($img)->save('uploads/sliders/'. $ffname);
        }
        $slide = Sliders::FindOrFail($id);
        $slide->slider_title = $request->slider_title;
        $slide->status = $request->status;
        if($img){
            $slide->image = $ffname;
        }
        $slide->save();
        Session::flash('success', 'Succesfully Updated Sliders');
        return redirect()->back();
    }
public function update ( Request $ request , $ id ) { $ this -> validateWith ( [ 'slider_title' => 'required' , ] ) ; $ img = $ request -> file ( 'image' ) ; if ( $ img ) { $ ffname = 'feat-' . str_slug ( $ request -> blog_title ) . '-' . str_random ( 8 ) . '.' . $ img -> getClientOriginalExtension ( ) ; Image :: make ( $ img ) -> save ( 'uploads/sliders/' . $ ffname ) ; } $ slide = Sliders :: FindOrFail ( $ id ) ; $ slide -> slider_title = $ request -> slider_title ; $ slide -> status = $ request -> status ; if ( $ img ) { $ slide -> image = $ ffname ; } $ slide -> save ( ) ; Session :: flash ( 'success' , 'Succesfully Updated Sliders' ) ; return redirect ( ) -> back ( ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
// 'image' => 'required',