Rough solution
Get all project ids where current user has invested. Save those ids in array.
Check each project id (got from Project::all()) with user projects. $ids[] = {1,2,3,4,5,6,7,8}
if (in_array($project_id, $ids)) { user has already invested on this project } else { user has not invested on this project display invest button }
you can use eloquent search insted of array
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community