Support the ongoing development of Laravel.io →
Authentication Security Validation
Last updated 9 months ago.
0

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 -_*

Last updated 9 months ago.
0

Thank you - is there a way to integrate this into the Auth::attempt() function?

Last updated 9 months ago.
0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

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.

© 2023 Laravel.io - All rights reserved.