I can't figure out why my data is not being passed to View I get the message Undefined variable: project
Can someone help identify where i am going wrong?
when i return $project->name straight from the controller it displays the response, however fails to pass to view.
Here is my controller function:
public function getApi(){
$client = new Client();
$response = $client->get('https://play.geokey.org.uk/api/projects/77');
$body = $response->getBody()->getContents();
$project = json_decode($body);
return view ('response', compact($project));
}
And here is my View:
<h1>Welcome</h1>
<table class="table table-bordered">
<tr>
<th>Project Name</th>
<th>Date of Creation</th>
<th>Contribution Total</th>
</tr>
<tr>
<td></td>
</tr>
</table>
via Jay240692