Well first you have to set your models relationships, in your case , one to one relation , since the users table hold the person_id , that means a user belongs to a person . check the following example :
class Person extends Eloquent {
...
public function users(){
return $this->hasOne('User');
}
...
}
class User extends Eloquent {
...
public function persons(){
return $this->belongsTo('Person');
}
...
}
Now since we have our relation set in the two sides we can do something like this:
$user= User::first();
if ($user->persons->email === Input::get('email')) {
//code here
}
//we can alse go with
$person= Person::first();
if ($person->users->somefield=== Input::get('something')) {
//code here
}
I hope this gunna help -_*
Thank you - is there a way to integrate this into the Auth::attempt() function?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community