Answer the question
In order to leave comments, you need to log in
Why does it not see the variable in foreach?
Laravel throws this error:
Undefined variable: Tasks;
public function find(Request $request){
$post_data = $request->all();
$name_user = $post_data['name-user'];
$tasks = Task::where('creator',$name_user)->get();
foreach($Tasks as $task):
echo $task;
endforeach;
}
Answer the question
In order to leave comments, you need to log in
because you are writing to $tasks, not to $Tasks
Look carefully at the registers
The register. You have declared the $tasks variable, but you are accessing a non-existent $Tasks.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question