app/Http/Controllers/HomeContentController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\HomeContent  $homeContent
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, HomeContent $homeContent)
    {
        $data=request()->validate([
            'aboutus_heading'=>'required',
            'aboutus_content'=>'required',
            'aboutus_image'=>'required',
            'factory_heading'=>'required',
            'factory_content'=>'required',
            'factory_image'=>'required',
            'outlet_heading'=>'required',
            'outlet_content'=>'required',
            'outlet_image'=>'required',
        ]);
        $imagePath = request('aboutus_image')->store('HomeContent', 'public');
        $image = Image::make("storage/{$imagePath}")->fit(555, 600);
        $imagePath1 = request('factory_image')->store('HomeContent', 'public');
        $image = Image::make("storage/{$imagePath}")->fit(555, 600);
        $imagePath2 = request('outlet_image')->store('HomeContent', 'public');
        $image = Image::make("storage/{$imagePath}")->fit(555, 600);
        $data = array_merge($data,['aboutus_image'=>$imagePath,'factory_image'=>$imagePath1,'outlet_image'=>$imagePath2]);
        $homeContent->update($data);
        return redirect('/homeContent');
    }
public function update ( Request $ request , HomeContent $ homeContent ) { $ data = request ( ) -> validate ( [ 'aboutus_heading' => 'required' , 'aboutus_content' => 'required' , 'aboutus_image' => 'required' , 'factory_heading' => 'required' , 'factory_content' => 'required' , 'factory_image' => 'required' , 'outlet_heading' => 'required' , 'outlet_content' => 'required' , 'outlet_image' => 'required' , ] ) ; $ imagePath = request ( 'aboutus_image' ) -> store ( 'HomeContent' , 'public' ) ; $ image = Image :: make ( " storage/ { $ imagePath } " ) -> fit ( 555 , 600 ) ; $ imagePath1 = request ( 'factory_image' ) -> store ( 'HomeContent' , 'public' ) ; $ image = Image :: make ( " storage/ { $ imagePath } " ) -> fit ( 555 , 600 ) ; $ imagePath2 = request ( 'outlet_image' ) -> store ( 'HomeContent' , 'public' ) ; $ image = Image :: make ( " storage/ { $ imagePath } " ) -> fit ( 555 , 600 ) ; $ data = array_merge ( $ data , [ 'aboutus_image' => $ imagePath , 'factory_image' => $ imagePath1 , 'outlet_image' => $ imagePath2 ] ) ; $ homeContent -> update ( $ data ) ; return redirect ( '/homeContent' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .