app/Http/Controllers/HomeController.php
//Code to add the vendor details
Code to add the vendor details
Code to add the vendor details
public function update_vendor(Request $request) {
        $this->validate($request, [
            'location' => 'required',
            'about_me' => 'required',
            'pnumber' => 'required',
        ]);
        $vendordetail = new VendorDetails;
        $vendordetail->user_id = Auth::id();
        $vendordetail->location = $request->get('location');
        $vendordetail->about = $request->get('about_me');
        $vendordetail->pnumber = $request->get('pnumber');
        if($vendordetail->save()) {
            return view('products.create')->with('success', 'Vendor profile updated successfully!');
        } else {
            Session::flash('error', 'There was an problem saving the updated user info to the database. Please Try Again!');
            return redirect()->route('vendor_details');
        }
    }
public function update_vendor ( Request $ request ) { $ this -> validate ( $ request , [ 'location' => 'required' , 'about_me' => 'required' , 'pnumber' => 'required' , ] ) ; $ vendordetail = new VendorDetails ; $ vendordetail -> user_id = Auth :: id ( ) ; $ vendordetail -> location = $ request -> get ( 'location' ) ; $ vendordetail -> about = $ request -> get ( 'about_me' ) ; $ vendordetail -> pnumber = $ request -> get ( 'pnumber' ) ; if ( $ vendordetail -> save ( ) ) { return view ( 'products.create' ) -> with ( 'success' , 'Vendor profile updated successfully!' ) ; } else { Session :: flash ( 'error' , 'There was an problem saving the updated user info to the database. Please Try Again!' ) ; return redirect ( ) -> route ( 'vendor_details' ) ; } }
Code to add the vendor details
Code to add the vendor details
// dd($vendordetail);