php - How to authenticate with Sentinel by username?


I'm using Sentinel by Cartalyst for authentication with PHP. The traditional way to authenticate is by use of e-mail and password, as we can read in their documentation:

$credentials = [
    'email'    => '[email protected]',
    'password' => 'password',


The default users table provided by the library is like that:

id | email | password | permissions |last_login | first_name | created_at | updated_at

I want to add a username column and authenticate using Sentinel by username and password. Is it possible?




You can modify this example here

In your Users model you must override the attribute $loginNames, and add username to the attribute $fillable.

use Cartalyst\Sentinel\Users\EloquentUser as SentinelUser;

class User extends SentinelUser {

    protected $fillable = [

    protected $loginNames = ['username'];


    'username'    => 'fake',
    'password' => 'password'

People are also looking for solutions to the problem: hyperlink - Grabbing onClick Value with PHP


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.