I have an Ads website, built on top of a CMS. Recently I have decided to write few managemenet utilities for it, and because the CMS code is crap, I wanted to stick with Laravel. My initial plan was to use the CMS 'user' table for Authorization, but I have got a problem with that.
The Laravel Auth does authorization correctly using email and password. After the authorization I can immediately dump all the data of the user. The problem is that after the first redirect the session is lost and user is no more logged in.
Here is the code
/*app/controllers/AuthController.php */
if(Auth::attempt(array('s_email' => Input::get('email'), 'password' => Input::get('password')), false)){
/*echo "<pre>"; var_dump(Auth::user()->pk_i_id); echo "</pre>";exit; */
return Redirect::route('dashboard');
};
//app/modesl/User.php
class User extends Eloquent implements UserInterface, RemindableInterface{
use UserTrait, RemindableTrait;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'user';
protected $primaryKey = 'pk_i_id';
/**
* This method is used to define the password field in 'Users' table
*/
public function getAuthPassword()
{
return $this->s_password;
}
}
//app/config/auth.php
'model' => 'User' // that is the only line modified (it was 'users' and i changed to 'user'
What might cause the trouble and how could that be solved?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community