app/Http/Controllers/HomeContentController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
    $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',
    ]);
        $id=auth()->user()->id;
        $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);
        $banner=HomeContent::create([
            'aboutus_heading'=>$data['aboutus_heading'],
            'aboutus_content'=>$data['aboutus_content'],
            'factory_heading'=>$data['factory_heading'],
            'factory_content'=>$data['factory_content'],
            'outlet_heading'=>$data['outlet_heading'],
            'outlet_content'=>$data['outlet_content'],
            'aboutus_image'=>$imagePath,
            'factory_image'=>$imagePath1,
            'outlet_image'=>$imagePath2,
            'user_id'=>$id
        ]);
        return redirect('/homeContent');
    }
public function store ( Request $ request ) { $ 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' , ] ) ; $ id = auth ( ) -> user ( ) -> id ; $ 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 ) ; $ banner = HomeContent :: create ( [ 'aboutus_heading' => $ data [ 'aboutus_heading' ] , 'aboutus_content' => $ data [ 'aboutus_content' ] , 'factory_heading' => $ data [ 'factory_heading' ] , 'factory_content' => $ data [ 'factory_content' ] , 'outlet_heading' => $ data [ 'outlet_heading' ] , 'outlet_content' => $ data [ 'outlet_content' ] , 'aboutus_image' => $ imagePath , 'factory_image' => $ imagePath1 , 'outlet_image' => $ imagePath2 , 'user_id' => $ id ] ) ; return redirect ( '/homeContent' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .