This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return array( | |
'multi'=>[ | |
'user' => [ | |
'driver' => 'eloquent', | |
'model' => 'User' | |
], | |
'admin' => [ | |
'driver' => 'eloquent', | |
'model' => 'Administrators' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::group(['prefix' => 'user'], function () { | |
Route::get('login', ['as' => 'login-user', 'uses' => 'AuthController@loginAdmin']); | |
Route::post('login', ['as' => 'login-user-post', 'uses' => 'AuthController@authAdmin'])->before('csrf'); | |
Route::get('dashboard', ['as' => 'dashboard-user', 'uses' => 'UserController@dashboard']); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AuthController extends BaseController | |
{ | |
public function loginUser() | |
{ | |
return View::make('user.login'); | |
} | |
public function authUser() | |
{ | |
$credentials = Input::only('username', 'password'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!Doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>Sign in</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | |
<!-- Open Sans font desde Google CDN --> | |
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,600,700,300&subset=latin" rel="stylesheet" type="text/css"> | |
<!-- Bootstrap 3 --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//para usar la configuracion de multi => user | |
Auth::user()->attempt($credentials); | |
//para usar la configuracion de multi => admin | |
Auth::admin()->attempt($credentials); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return array( | |
/*'driver' => 'eloquent', | |
'model' => 'User', | |
'table' => 'users',*/ | |
'multi' => array( | |
'user' => array( | |
'driver' => 'eloquent', | |
'model' => 'User' | |
), | |
'admin' => array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'providers' => array( | |
'Illuminate\Foundation\Providers\ArtisanServiceProvider', | |
/*'Illuminate\Auth\AuthServiceProvider',*/ //comentamos esta linea | |
'Illuminate\Cache\CacheServiceProvider', | |
'Illuminate\Session\CommandsServiceProvider', | |
'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', | |
'Illuminate\Routing\ControllerServiceProvider', | |
'Illuminate\Cookie\CookieServiceProvider', | |
'Illuminate\Database\DatabaseServiceProvider', | |
'Illuminate\Encryption\EncryptionServiceProvider', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"require" : { | |
"ollieread/multiauth" : "dev-master" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
$pdo = new PDO('mysql:host=localhost;dbname=test', 'user', 'password'); | |
} catch (PDOException $exc) { | |
die($exc->getMessage()); | |
} | |
$simpleQuery = $pdo->query('SELECT * FROM user WHERE rol_id = 2 LIMIT 3'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function create() { | |
$input = Input::except('_token'); | |
$rules = [ | |
'firstname' => 'required', | |
'lastname' => 'required', | |
'email' => 'required|email|unique:usuario,email_usr', | |
'password' => 'required|min:8|confirmed', | |
'password_confirmation' => 'required', | |
]; | |