/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $sprints = Sprint::lists('id', 'id'); $us_stories = Userstory::lists('description', 'id'); $tache = Tache::findOrNew($id); $predecessors = Tache::lists('code', 'code'); return view('taches.edit', compact('tache', 'sprints', 'us_stories', 'predecessors')); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { /* $ntaches = Tache::all(); $ntaches = Tache::all(); $descriptions = Tache::lists('description','id'); $user = Auth::user(); $taches = array(); $i = 0; $cpt = 0; foreach($ntaches as $tache){ if($tache->sprint_id == $id) { if($tache->developer_id == Auth::id() && $tache->state == 1){ Session::flash('fail',"You have already a task, please finish your task !"); $taches= array(); break; } else if($tache->state != 1){ $taches[$i] = $tache ; } foreach($taches as $tache){ $pred[$tache->code] = explode(",",$tache->predecessors); } for($i= 0 ; $i < count($pred[$tache->code]); $i++){ if(!empty($tache->code)){ $j=0; foreach($ntaches as $tac){ if($tac->code==$pred[$tache->code][$i] ){ if( $tac->state !=2){ $depend[$tache->id][$j]=$pred[$tache->code][$i]; } else{ $depend[$tache->id][$j]=null; } $j++; } } } } } $i++; } //dd($whoDoWhat); //dd($taches); // return view('kanban.index', ['taches' => $taches, 'results'=> $whoDoWhat, 'id'=> $id]); return view('taketache.index',compact('taches','descriptions','user','id','depend'));*/ $ntaches = Tache::all(); $descriptions = Tache::lists('description', 'id'); $user = Auth::user(); $taches = array(); $i = 0; $cpt = 0; foreach ($ntaches as $tache) { if ($tache->sprint_id == $id) { if ($tache->developer_id == Auth::id() && $tache->state == 1) { Session::flash('fail', "You have already a task, please finish your task !"); $taches = array(); break; } else { if ($tache->state != 1) { $taches[$i] = $tache; } } } $i++; } //dd($whoDoWhat); //dd($taches); // return view('kanban.index', ['taches' => $taches, 'results'=> $whoDoWhat, 'id'=> $id]); return view('taketache.index', compact('taches', 'descriptions', 'user', 'id')); }