app/Http/Controllers/Admin/vendorController.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(VendorValidator $request)
    {
        if ($request->hasFile('image')) {
            $image = $request->file('image');
            $images = "image-" . time() . '.' . $image->getClientOriginalExtension();
            $image->move('images/vendor/', $images);
            }
        if ($request->hasFile('resume')) {
                $image = $request->file('resume');
                $resumes = "resume-" . time() . '.' . $image->getClientOriginalExtension();
                $image->move('images/vendor/', $resumes);
            }
        if ($request->hasFile('ctzn_front')) {
                    $image = $request->file('ctzn_front');
                    $front = "citizenfront-" . time() . '.' . $image->getClientOriginalExtension();
                    $image->move('images/vendor/', $front);
                }
        if ($request->hasFile('ctzn_back')) {
                    $image = $request->file('ctzn_back');
                    $back = "citizenback-" . time() . '.' . $image->getClientOriginalExtension();
                    $image->move('images/vendor/', $back);
                }
        if ($request->hasFile('offer_letter')) {
                    $image = $request->file('offer_letter');
                    $offer = "offerletter-" . time() . '.' . $image->getClientOriginalExtension();
                    $image->move('images/vendor/', $offer);
                }
        if ($request->hasFile('joining_letter')) {
                    $image = $request->file('joining_letter');
                    $joining = "joiningletter-" . time() . '.' . $image->getClientOriginalExtension();
                    $image->move('images/vendor/', $joining);
                }
        if ($request->hasFile('contract_agreement')) {
                    $image = $request->file('contract_agreement');
                    $contract_agreement = "contract-" . time() . '.' . $image->getClientOriginalExtension();
                    $image->move('images/vendor/', $contract_agreement);
                }
                $vendor = new Vendor([
                    'fname' => $request->fname,
                    'lname' => $request->lname,
                    'dob' => $request->dob,
                    'registrationnumber' => $request->registrationnumber,
                    'panvatnumber' => $request->panvatnumber,
                    'email'   => $request->email,
                    'mobileno' => $request->mobileno,
                    'phoneno' => $request->phoneno,
                    'firstcontactperson' => $request->firstcontactperson,
                    'firstemail' => $request->firstemail,
                    'firstphone' => $request->firstphone,
                    'secondcontactperson' => $request->secondcontactperson,
                    'secondemail' => $request->secondemail,
                    'secondphone' => $request->secondphone,
                    'city' => $request->city,
                    'district' => $request->district,
                    'vendor_type' => $request->vendor_type,
                    'permanent_address' => $request->permanent_address,
                    'temporary_address' => $request->temporary_address,
                    'gender' => $request->gender
                ]);
                $vendor->image = $images;
            $vendor->resume = $resumes;
            $vendor->ctzn_front = $front;
            $vendor->ctzn_back = $back;
            $vendor->offer_letter = $offer;
            $vendor->joining_letter = $joining;
            $vendor->contract_agreement = $contract_agreement;
            $vendor->save();
        return redirect()->route('Vendors.index')->with('success', 'Vendor Created successfully');
    }
public function store ( VendorValidator $ request ) { if ( $ request -> hasFile ( 'image' ) ) { $ image = $ request -> file ( 'image' ) ; $ images = " image- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'images/vendor/' , $ images ) ; } if ( $ request -> hasFile ( 'resume' ) ) { $ image = $ request -> file ( 'resume' ) ; $ resumes = " resume- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'images/vendor/' , $ resumes ) ; } if ( $ request -> hasFile ( 'ctzn_front' ) ) { $ image = $ request -> file ( 'ctzn_front' ) ; $ front = " citizenfront- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'images/vendor/' , $ front ) ; } if ( $ request -> hasFile ( 'ctzn_back' ) ) { $ image = $ request -> file ( 'ctzn_back' ) ; $ back = " citizenback- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'images/vendor/' , $ back ) ; } if ( $ request -> hasFile ( 'offer_letter' ) ) { $ image = $ request -> file ( 'offer_letter' ) ; $ offer = " offerletter- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'images/vendor/' , $ offer ) ; } if ( $ request -> hasFile ( 'joining_letter' ) ) { $ image = $ request -> file ( 'joining_letter' ) ; $ joining = " joiningletter- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'images/vendor/' , $ joining ) ; } if ( $ request -> hasFile ( 'contract_agreement' ) ) { $ image = $ request -> file ( 'contract_agreement' ) ; $ contract_agreement = " contract- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'images/vendor/' , $ contract_agreement ) ; } $ vendor = new Vendor ( [ 'fname' => $ request -> fname , 'lname' => $ request -> lname , 'dob' => $ request -> dob , 'registrationnumber' => $ request -> registrationnumber , 'panvatnumber' => $ request -> panvatnumber , 'email' => $ request -> email , 'mobileno' => $ request -> mobileno , 'phoneno' => $ request -> phoneno , 'firstcontactperson' => $ request -> firstcontactperson , 'firstemail' => $ request -> firstemail , 'firstphone' => $ request -> firstphone , 'secondcontactperson' => $ request -> secondcontactperson , 'secondemail' => $ request -> secondemail , 'secondphone' => $ request -> secondphone , 'city' => $ request -> city , 'district' => $ request -> district , 'vendor_type' => $ request -> vendor_type , 'permanent_address' => $ request -> permanent_address , 'temporary_address' => $ request -> temporary_address , 'gender' => $ request -> gender ] ) ; $ vendor -> image = $ images ; $ vendor -> resume = $ resumes ; $ vendor -> ctzn_front = $ front ; $ vendor -> ctzn_back = $ back ; $ vendor -> offer_letter = $ offer ; $ vendor -> joining_letter = $ joining ; $ vendor -> contract_agreement = $ contract_agreement ; $ vendor -> save ( ) ; return redirect ( ) -> route ( 'Vendors.index' ) -> with ( 'success' , 'Vendor Created successfully' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .