Support the ongoing development of Laravel.io →
Database Eloquent Views
Last updated 2 years ago.
0

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

0

Sign in to participate in this thread!

Eventy

Your banner here too?

basherr basherr Joined 18 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.