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

first of all the relationship going on between the project and the client is one to many in a broader sense a client will have one or many project will a project belongs to a client that means in your user class model the relationship should be

public function projects() { return $this->hasMany("App\project"); }

while in your project model class you should have

public function client() { return $this->belongsTo("App\User"); }

that way you can query them easily i hope this help your case . give me feed back when you try it

0

Sign in to participate in this thread!

Eventy

Your banner here too?

johnef johnef Joined 18 May 2016

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.