app/Http/Controllers/AgreementHeaderController.php
/**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
Show the form for creating a new resource.
@return \Illuminate\Http\Response
Show the form for creating a new resource . @return \ Illuminate \ Http \ Response
public function create()
    {
    	$checkAgreementID = AgreementHeader::orderBy('agreementID', 'desc')->first();
    	$supplier = Supplier::pluck('name', 'supplierID')->toArray();
		$agreementType = AgreementHeader::pluck('type', 'type')->toArray();
		$newArray = [];
		$count = 0;
		$virtualID = Item::pluck('virtualItemID')->toArray();  
    	$unit = Item::pluck('unitOfMeasurement')->toArray();
		$itemName = Item::pluck('name', 'itemID')->toArray();  
		foreach($itemName as $key => $value) {
    		$value = $virtualID[$count]." : ".$value." --- ".$unit[$count] ;
    		$newArray[$key] = $value;
    		$count++;
    	}
		$latestAgreementIDAndRevision = AgreementHeader::orderBy('agreementID', 'desc')->first();
		return View::make('agreementHeader.create')->with('checkAgreementID',$checkAgreementID)
												   ->with('supplier',$supplier)
												   ->with('agreementType',$agreementType)
												   ->with('itemName',$newArray)
												   ->with('latestAgreementIDAndRevision',$latestAgreementIDAndRevision);
    }
public function create ( ) { $ checkAgreementID = AgreementHeader :: orderBy ( 'agreementID' , 'desc' ) -> first ( ) ; $ supplier = Supplier :: pluck ( 'name' , 'supplierID' ) -> toArray ( ) ; $ agreementType = AgreementHeader :: pluck ( 'type' , 'type' ) -> toArray ( ) ; $ newArray = [ ] ; $ count = 0 ; $ virtualID = Item :: pluck ( 'virtualItemID' ) -> toArray ( ) ; $ unit = Item :: pluck ( 'unitOfMeasurement' ) -> toArray ( ) ; $ itemName = Item :: pluck ( 'name' , 'itemID' ) -> toArray ( ) ; foreach ( $ itemName as $ key => $ value ) { $ value = $ virtualID [ $ count ] . "  :  " . $ value . "  ---  " . $ unit [ $ count ] ; $ newArray [ $ key ] = $ value ; $ count ++ ; } $ latestAgreementIDAndRevision = AgreementHeader :: orderBy ( 'agreementID' , 'desc' ) -> first ( ) ; return View :: make ( 'agreementHeader.create' ) -> with ( 'checkAgreementID' , $ checkAgreementID ) -> with ( 'supplier' , $ supplier ) -> with ( 'agreementType' , $ agreementType ) -> with ( 'itemName' , $ newArray ) -> with ( 'latestAgreementIDAndRevision' , $ latestAgreementIDAndRevision ) ; }
Show the form for creating a new resource.
Show the form for creating a new resource .
//orderBy("virtualItemID")->  <<deleted! //orderBy('name', 'asc')->