I'm trying to convert my image string to an actually image. Which I had put in the $response object.
But I want to add it to my $projects array, but I don't know how. However I did tried this:
class ProjectController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$projects = Project::all();
foreach ($projects as $key => $value) {
$response = new \stdClass();
$response = Response::make($value->image, 200);
$response->header('Content-Type', 'image/jpeg');
$projects[] = $response;
}
return view('projects.index', ['projects' => $projects]);
}
But it didn't work, because it didn't put the $response object in each project. Here is a picture to show you what I mean:
In the database you can see that I only have four projects.


$projectsand put that in a view ? ?