app/Http/Controllers/DownloadController.php
/**
	 * Store a newly created resource in storage.
	 *
	 * @return Response
	 */
Store a newly created resource in storage.
@return Response
Store a newly created resource in storage . @return Response
public function store(Request $request)
	{	
		$dt 			= Carbon::now()->format('dmyhis');
		$tp_id 			= session()->get('open_project');
		$loc 			= session()->get('autorun_location');
		$id 			= $request->tc_ids;
		$page_loc		= $request->autorun;
		if($page_loc == "")
		{
			$message = $this->getMessage('messages.autorun_location_required');
  			Toast::message($message, 'danger'); 
		}elseif(!File::exists($page_loc)){
			$message = $this->getMessage('messages.autorun_location_incorrect');
  			Toast::message($message, 'danger');			
		}else{
			if($page_loc != $loc)
			{
				session()->set('autorun_location' , $page_loc);
				$user_id = session()->get('id');
				$user = \App\User::find($user_id)->update(['autorun_location' => $page_loc]);
			}
			if($id == $tp_id)
			{
				$cases = \App\TestCase::select('tc_id')->where('tp_id', $id)->get()->toArray();
				foreach ($cases as $key => $value) {
					$ids[] = $value['tc_id'];
				}
			}else{
				$ids 			= explode($this->getDelimiterChar(),$id,-1);			
			}
			$count 			= count($ids);
			$filename 		= $tp_id."_".$count."_".$dt;
			$data 			= $this->createExcelData($ids, $filename, $request);
			session()->save();
			$this->processDownload($data, $filename); 	
		}	
		return redirect()->back();
	}
public function store ( Request $ request ) { $ dt = Carbon :: now ( ) -> format ( 'dmyhis' ) ; $ tp_id = session ( ) -> get ( 'open_project' ) ; $ loc = session ( ) -> get ( 'autorun_location' ) ; $ id = $ request -> tc_ids ; $ page_loc = $ request -> autorun ; if ( $ page_loc == " " ) { $ message = $ this -> getMessage ( 'messages.autorun_location_required' ) ; Toast :: message ( $ message , 'danger' ) ; } elseif ( ! File :: exists ( $ page_loc ) ) { $ message = $ this -> getMessage ( 'messages.autorun_location_incorrect' ) ; Toast :: message ( $ message , 'danger' ) ; } else { if ( $ page_loc != $ loc ) { session ( ) -> set ( 'autorun_location' , $ page_loc ) ; $ user_id = session ( ) -> get ( 'id' ) ; $ user = \ App \ User :: find ( $ user_id ) -> update ( [ 'autorun_location' => $ page_loc ] ) ; } if ( $ id == $ tp_id ) { $ cases = \ App \ TestCase :: select ( 'tc_id' ) -> where ( 'tp_id' , $ id ) -> get ( ) -> toArray ( ) ; foreach ( $ cases as $ key => $ value ) { $ ids [ ] = $ value [ 'tc_id' ] ; } } else { $ ids = explode ( $ this -> getDelimiterChar ( ) , $ id , - 1 ) ; } $ count = count ( $ ids ) ; $ filename = $ tp_id . " _ " . $ count . " _ " . $ dt ; $ data = $ this -> createExcelData ( $ ids , $ filename , $ request ) ; session ( ) -> save ( ) ; $ this -> processDownload ( $ data , $ filename ) ; } return redirect ( ) -> back ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .