mercredi 24 octobre 2018

Laravel Data change when i pass it from Controller To view

i have relations path has many tags and tags have many tasks and tasks have many tags so task may have one or more tag . My Controller return tasks that have 1 tag only and is working fine

public function task(){

 $Tasks= Path::with(['pathtags' => function ($q) {
  $q->with(['Tasks'=>function($q) {
  $q->has('tasktags', '=' , 1)
 ->with('tasktags'); }]); 
 }])->first();

  return $Tasks;
}

but When I return $Tasks in view I get all tasks in the database

i tried

  return view('task', ['Tasks' => $Tasks);
  return view('box',compact('Tasks'));

but still get all tasks not one that have 1 tag



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire