app/Http/Controllers/Admin/TestimonialController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Testimonial  $testimonial
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(UpdateTestimonialRequest $request, Testimonial $testimonial)
    {
        if ($request->hasFile('t_image')) {
            $image       = $request->file('t_image');
            $filename    = $image->getClientOriginalName();
            $image_resize = Image::make($image->getRealPath());
            $image_resize->resize(300, 300, function ($constraint) {
                $constraint->aspectRatio();
            })->save(public_path('storage/testimonial/' . $filename));
            $testimonial->t_image = $filename;
        }
        $testimonial->t_name = $request->t_name;
        $testimonial->t_testimonial = $request->t_testimonial;
        $testimonial->save();
        return redirect(route('admin.testimonial.index'))->with('success','Testimonial successfully Update.');
    }
public function update ( UpdateTestimonialRequest $ request , Testimonial $ testimonial ) { if ( $ request -> hasFile ( 't_image' ) ) { $ image = $ request -> file ( 't_image' ) ; $ filename = $ image -> getClientOriginalName ( ) ; $ image_resize = Image :: make ( $ image -> getRealPath ( ) ) ; $ image_resize -> resize ( 300 , 300 , function ( $ constraint ) { $ constraint -> aspectRatio ( ) ; } ) -> save ( public_path ( 'storage/testimonial/' . $ filename ) ) ; $ testimonial -> t_image = $ filename ; } $ testimonial -> t_name = $ request -> t_name ; $ testimonial -> t_testimonial = $ request -> t_testimonial ; $ testimonial -> save ( ) ; return redirect ( route ( 'admin.testimonial.index' ) ) -> with ( 'success' , 'Testimonial successfully Update.' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .