PHP code example of malezha / sentry-auth-laravel

1. Go to this page and download the library: Download malezha/sentry-auth-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

malezha / sentry-auth-laravel example snippets


'providers' => array(
	...
	'Cartalyst\Sentry\SentryServiceProvider',
	'Malezha\Sentry\Auth\SentryAuthServiceProvider',
	'Malezha\Sentry\Hashing\SentryHashServiceProvider',

),

'aliases' => array(
	...
	'Sentry'            => 'Cartalyst\Sentry\Facades\Laravel\Sentry'
),

'driver' => 'sentry',

use Malezha\Sentry\Auth\SentryUser;

class User extends SentryUser
{

	/**
	* The attributes excluded from the model's JSON form.
	*
	* @var array
	*/
	protected $hidden = array(
		'password',
		'reset_password_code',
		'activation_code',
		'persist_code',
		'remember_token',
	);

}

'model' => 'User',

'users' => array(
	'model' => 'User',
),

$loginfield = \Malezha\Sentry\Auth\SentryUser::getLoginAttributeName();

$loginfield = Config::get('cartalyst/sentry::users.login_attribute');

$loginfield = \Malezha\Sentry\Auth\SentryUser::getLoginAttributeName();
$passwordfield = 'password';

$credentials = array(
	$loginfield => Input::get('email'),
	$passwordfield => Input::get('password')
);

if (Auth::attempt($credentials))
{
	// successfully logged in
}
else
{
	// authentication failed
}
shell
php artisan migrate --package=cartalyst/sentry
php artisan migrate --package=malezha/sentry-auth-laravel
shell
php artisan config:publish cartalyst/sentry