Skip to content

Instantly share code, notes, and snippets.

View Sarav-S's full-sized avatar

Sarav Sarav-S

View GitHub Profile
<?php
$credentials = [
'email' => $request->input('email'),
'password' => $request->input('password')
];
if (Auth::attempt($credentials, $request->has('remember'))) {
}
<?php
/**
* Attempt to authenticate a user using the given credentials.
*
* @param array $credentials
* @param bool $remember
* @param bool $login
* @return bool
*/
@Sarav-S
Sarav-S / auth.php
Last active September 23, 2016 02:11
<?php
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
],
<?php
/**
* Retrieve a user by the given credentials.
*
* @param array $credentials
* @return \Illuminate\Contracts\Auth\Authenticatable|null
*/
public function retrieveByCredentials(array $credentials)
{
<?php
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(UserContract $user, array $credentials)
<?php
/**
* Check the given plain value against a hash.
*
* @param string $value
* @param string $hashedValue
* @param array $options
* @return bool
*/
<?php
/**
* Hash the given value.
*
* @param string $value
* @param array $options
* @return string
*
* @throws \RuntimeException
@Sarav-S
Sarav-S / kernel.php
Last active September 23, 2016 02:08
<?php
/**
*
*
**/
'admin.auth' => \App\Http\Middleware\AdminAuthenticate::class,
'admin.guest' => \App\Http\Middleware\AdminRedirectIfAuthenticated::class,
@Sarav-S
Sarav-S / sample.php
Last active September 23, 2016 02:07
<?php
// To fetch admin user
Auth::guard('admin')->user()
//or
auth()->guard('admin')->user()
// To check whether admin user is logged in or not
Auth::guard('admin')->check()
<?php
if (! function_exists('admin') )
{
/**
* Returns the admin session instance
*
* @return mixed
*/
function admin()