Ok so I have a Verify object.
class Verify extends Ardent {
protected $table;
public $autoPurgeRedundantAttributes = true;
public static $passwordAttributes = array('password');
public $autoHashPasswordAttributes = true;
public static $rules = array(
'email' => 'required|unique:users,email|email',
'password' => 'required|confirmed',
'password_confirmation' => 'required',
'fname' => 'required|max:30',
'lname' => 'required|max:40',
'address' => 'required|max:50',
'city' => 'required|max:50',
'state' => 'required|max:2',
'zip' => 'required|max:6',
'phone' => 'required|max:15'
);
protected $fillable = array('email', 'password', 'fname', 'lname', 'address', 'city', 'state', 'zip', 'phone');
protected $status = array(
0 => 'inactive',
1 => 'confirmed'
);
protected $identify = 'email'; // identify column in the db
}
But when I extend it and try to overwrite the $identify property, it still uses the 'email' value instead:
<?php namespace Intellect\Alkharia\Models\User;
use Intellectproductions\Verify\Verify;
use Zizaco\Entrust\HasRole;
class User extends Verify {
public static $rules = array(
'username' => 'required|alpha_dash|unique:users,username|max:30',
'email' => 'required|unique:users,email|email|max:50',
'password' => 'required|confirmed',
'password_confirmation' => 'required',
'name' => 'required|max:35',
'birthday' => 'required|date_format:Y-m-d',
'verification' => 'required|equals:4'
);
protected $fillable = array('username', 'email', 'password', 'name', 'birthday');
protected $identify = 'username'; // identify column in the db
}
But all the other properties successfully overrode.
Here is the method in the Verify object:
/**
* Forgot password
*
*/
public function forgotPassword($username) {
dd($this->identify);
$user = Verify::where($this->identify, $username)->first(array('id', 'email', 'username'));
dd($user);
if($user) {
// user was found so generate token and send email
$token = md5( uniqid(mt_rand(), true) );
$values = array(
'email'=> $user->email,
'token'=> $token,
'created_at'=> new \DateTime
);
\DB::connection()->table('password_reminders')
->insert( $values );
$this->sendResetEmail(array('user' => $user, 'token' => $token));
\Session::flash('message', 'Your instructions on how to reset your password has been sent to your email.');
return true;
} else {
\Session::flash('error', 'That email does not exist!');
return false;
}
}
dd($this->identify) will spit on the value of it. And it says 'email' still, not 'username'.. Any ideas on why?