app/Http/Controllers/AboutController.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([
            'about_heading'=>'required',
            'about_image'=>'required',
            'about_desc'=>'required',
            'service_heading'=>'required',
            'service_head_desc'=>'required',
            'partners_heading'=>'required',
            'partners_head_desc'=>'required',
            'about_title'=>'required',
        ]);
        $id=auth()->user()->id;
        $name=auth()->user()->name;
        $imagePath = request('about_image')->store('AboutImages', 'public');
        $image = Image::make("storage/{$imagePath}")->fit(555, 600);
        $about=About::create([
            'about_heading'=>$data['about_heading'] ,
            'about_title'=>$data['about_title'],
            'service_heading'=>$data['service_heading'] ,
            'service_head_desc'=>$data['service_head_desc'] ,
            'partners_heading'=>$data['partners_heading'] ,
            'partners_head_desc'=>$data['partners_head_desc'] ,
            'about_image'=>$imagePath,
            'about_desc'=>$data['about_desc'] ,
            'user_id'=>$id ,
            'created_by'=>$name
        ]);
        Alert::success('Success', 'Data Inserted Sucessfully');
        return redirect('/abouts');
    }
public function store ( Request $ request ) { $ data = request ( ) -> validate ( [ 'about_heading' => 'required' , 'about_image' => 'required' , 'about_desc' => 'required' , 'service_heading' => 'required' , 'service_head_desc' => 'required' , 'partners_heading' => 'required' , 'partners_head_desc' => 'required' , 'about_title' => 'required' , ] ) ; $ id = auth ( ) -> user ( ) -> id ; $ name = auth ( ) -> user ( ) -> name ; $ imagePath = request ( 'about_image' ) -> store ( 'AboutImages' , 'public' ) ; $ image = Image :: make ( " storage/ { $ imagePath } " ) -> fit ( 555 , 600 ) ; $ about = About :: create ( [ 'about_heading' => $ data [ 'about_heading' ] , 'about_title' => $ data [ 'about_title' ] , 'service_heading' => $ data [ 'service_heading' ] , 'service_head_desc' => $ data [ 'service_head_desc' ] , 'partners_heading' => $ data [ 'partners_heading' ] , 'partners_head_desc' => $ data [ 'partners_head_desc' ] , 'about_image' => $ imagePath , 'about_desc' => $ data [ 'about_desc' ] , 'user_id' => $ id , 'created_by' => $ name ] ) ; Alert :: success ( 'Success' , 'Data Inserted Sucessfully' ) ; return redirect ( '/abouts' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .