app/Http/Controllers/Admin/ServiceController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Service  $service
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(UpdateServiceRequest $request, Service $service)
    {
        if ($request->hasFile('service_image')) {
            $image       = $request->file('service_image');
            $filename    = $image->getClientOriginalName();
            $image_resize = Image::make($image->getRealPath());              
            $image_resize->resize(45, 45, function ($constraint) {
                $constraint->aspectRatio();
            })->save(public_path('storage/services/' .$filename));
            $service->service_image = $filename;
        }
        $service->service_title = $request->service_title;
        $service->service_slug = Str::slug($request->service_title, '-');
        $service->service_description = $request->service_description;
        $service->service_seo_title = $request->service_seo_title;
        $service->service_seo_description = $request->service_seo_description;
        $service->service_seo_keyword = $request->service_seo_keyword;
        $service->save();
        return redirect(route('admin.services.index'))->with('success','Service successfully Update.');
    }
public function update ( UpdateServiceRequest $ request , Service $ service ) { if ( $ request -> hasFile ( 'service_image' ) ) { $ image = $ request -> file ( 'service_image' ) ; $ filename = $ image -> getClientOriginalName ( ) ; $ image_resize = Image :: make ( $ image -> getRealPath ( ) ) ; $ image_resize -> resize ( 45 , 45 , function ( $ constraint ) { $ constraint -> aspectRatio ( ) ; } ) -> save ( public_path ( 'storage/services/' . $ filename ) ) ; $ service -> service_image = $ filename ; } $ service -> service_title = $ request -> service_title ; $ service -> service_slug = Str :: slug ( $ request -> service_title , '-' ) ; $ service -> service_description = $ request -> service_description ; $ service -> service_seo_title = $ request -> service_seo_title ; $ service -> service_seo_description = $ request -> service_seo_description ; $ service -> service_seo_keyword = $ request -> service_seo_keyword ; $ service -> save ( ) ; return redirect ( route ( 'admin.services.index' ) ) -> with ( 'success' , 'Service successfully Update.' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .