-
-
Save anonymous/2519a90ecd9770f1ff8f4791162768f1 to your computer and use it in GitHub Desktop.
This file contains 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 | |
return [ | |
/* | |
|-------------------------------------------------------------------------- | |
| Authentication Defaults | |
|-------------------------------------------------------------------------- | |
| | |
| This option controls the default authentication "guard" and password | |
| reset options for your application. You may change these defaults | |
| as required, but they're a perfect start for most applications. | |
| | |
*/ | |
'defaults' => [ | |
'guard' => 'web', | |
'passwords' => 'users', | |
], | |
/* | |
|-------------------------------------------------------------------------- | |
| Authentication Guards | |
|-------------------------------------------------------------------------- | |
| | |
| Next, you may define every authentication guard for your application. | |
| Of course, a great default configuration has been defined for you | |
| here which uses session storage and the Eloquent user provider. | |
| | |
| All authentication drivers have a user provider. This defines how the | |
| users are actually retrieved out of your database or other storage | |
| mechanisms used by this application to persist your user's data. | |
| | |
| Supported: "session", "token" | |
| | |
*/ | |
'guards' => [ | |
'web' => [ | |
'driver' => 'session', | |
'provider' => 'users', | |
], | |
'api' => [ | |
'driver' => 'token', | |
'provider' => 'users', | |
], | |
], | |
/* | |
|-------------------------------------------------------------------------- | |
| User Providers | |
|-------------------------------------------------------------------------- | |
| | |
| All authentication drivers have a user provider. This defines how the | |
| users are actually retrieved out of your database or other storage | |
| mechanisms used by this application to persist your user's data. | |
| | |
| If you have multiple user tables or models you may configure multiple | |
| sources which represent each model / table. These sources may then | |
| be assigned to any extra authentication guards you have defined. | |
| | |
| Supported: "database", "eloquent" | |
| | |
*/ | |
'providers' => [ | |
'users' => [ | |
'driver' => 'eloquent', | |
'model' => App\User::class, | |
], | |
// 'users' => [ | |
// 'driver' => 'database', | |
// 'table' => 'users', | |
// ], | |
], | |
/* | |
|-------------------------------------------------------------------------- | |
| Resetting Passwords | |
|-------------------------------------------------------------------------- | |
| | |
| You may specify multiple password reset configurations if you have more | |
| than one user table or model in the application and you want to have | |
| separate password reset settings based on the specific user types. | |
| | |
| The expire time is the number of minutes that the reset token should be | |
| considered valid. This security feature keeps tokens short-lived so | |
| they have less time to be guessed. You may change this as needed. | |
| | |
*/ | |
'passwords' => [ | |
'users' => [ | |
'provider' => 'users', | |
'table' => 'password_resets', | |
'expire' => 60, | |
], | |
], | |
]; |
This file contains 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 | |
return [ | |
/* | |
|-------------------------------------------------------------------------- | |
| PDO Fetch Style | |
|-------------------------------------------------------------------------- | |
| | |
| By default, database results will be returned as instances of the PHP | |
| stdClass object; however, you may desire to retrieve records in an | |
| array format for simplicity. Here you can tweak the fetch style. | |
| | |
*/ | |
'fetch' => PDO::FETCH_OBJ, | |
/* | |
|-------------------------------------------------------------------------- | |
| Default Database Connection Name | |
|-------------------------------------------------------------------------- | |
| | |
| Here you may specify which of the database connections below you wish | |
| to use as your default connection for all database work. Of course | |
| you may use many connections at once using the Database library. | |
| | |
*/ | |
'default' => 'web', | |
/* | |
|-------------------------------------------------------------------------- | |
| Database Connections | |
|-------------------------------------------------------------------------- | |
| | |
| Here are each of the database connections setup for your application. | |
| Of course, examples of configuring each database platform that is | |
| supported by Laravel is shown below to make development simple. | |
| | |
| | |
| All database work in Laravel is done through the PHP PDO facilities | |
| so make sure you have the driver for your particular database of | |
| choice installed on your machine before you begin development. | |
| | |
*/ | |
'connections' => [ | |
'web' => [ | |
'driver' => 'mysql', | |
'host' => 'localhost', | |
'port' => '3306', | |
'database' => 'host_db1', | |
'username' => 'username1', | |
'password' => 'secret1', | |
'charset' => 'utf8', | |
'collation' => 'utf8_unicode_ci', | |
'prefix' => '', | |
'strict' => true, | |
'engine' => null, | |
], | |
'another' => [ | |
'driver' => 'mysql', | |
'host' => 'localhost', | |
'port' => '3306', | |
'database' => 'host_db2', | |
'username' => 'username2', | |
'password' => 'secret2', | |
'charset' => 'utf8', | |
'collation' => 'utf8_unicode_ci', | |
'prefix' => '', | |
'strict' => true, | |
'engine' => null, | |
], | |
], | |
/* | |
|-------------------------------------------------------------------------- | |
| Migration Repository Table | |
|-------------------------------------------------------------------------- | |
| | |
| This table keeps track of all the migrations that have already run for | |
| your application. Using this information, we can determine which of | |
| the migrations on disk haven't actually been run in the database. | |
| | |
*/ | |
'migrations' => 'migrations', | |
/* | |
|-------------------------------------------------------------------------- | |
| Redis Databases | |
|-------------------------------------------------------------------------- | |
| | |
| Redis is an open source, fast, and advanced key-value store that also | |
| provides a richer set of commands than a typical key-value systems | |
| such as APC or Memcached. Laravel makes it easy to dig right in. | |
| | |
*/ | |
'redis' => [ | |
'cluster' => false, | |
'default' => [ | |
'host' => env('REDIS_HOST', 'localhost'), | |
'password' => env('REDIS_PASSWORD', null), | |
'port' => env('REDIS_PORT', 6379), | |
'database' => 0, | |
], | |
], | |
]; |
This file contains 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 | |
namespace App\Http\Controllers\Auth; | |
use App\User; | |
use Validator; | |
use App\Http\Controllers\Controller; | |
use Illuminate\Foundation\Auth\RegistersUsers; | |
class RegisterController extends Controller | |
{ | |
/* | |
|-------------------------------------------------------------------------- | |
| Register Controller | |
|-------------------------------------------------------------------------- | |
| | |
| This controller handles the registration of new users as well as their | |
| validation and creation. By default this controller uses a trait to | |
| provide this functionality without requiring any additional code. | |
| | |
*/ | |
use RegistersUsers; | |
/** | |
* Where to redirect users after login / registration. | |
* | |
* @var string | |
*/ | |
protected $redirectTo = '/home'; | |
/** | |
* Create a new controller instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
$this->middleware('guest'); | |
} | |
/** | |
* Get a validator for an incoming registration request. | |
* | |
* @param array $data | |
* @return \Illuminate\Contracts\Validation\Validator | |
*/ | |
protected function validator(array $data) | |
{ | |
return Validator::make($data, [ | |
'name' => 'required|max:255', | |
'email' => 'required|email|max:255|unique:users', | |
'password' => 'required|min:6|confirmed', | |
]); | |
} | |
/** | |
* Create a new user instance after a valid registration. | |
* | |
* @param array $data | |
* @return User | |
*/ | |
protected function create(array $data) | |
{ | |
return User::create([ | |
'name' => $data['name'], | |
'email' => $data['email'], | |
'password' => bcrypt($data['password']), | |
]); | |
} | |
} |
This file contains 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 | |
namespace App; | |
use Illuminate\Notifications\Notifiable; | |
use Illuminate\Foundation\Auth\User as Authenticatable; | |
class User extends Authenticatable | |
{ | |
use Notifiable; | |
protected $connection = 'another'; | |
/** | |
* The attributes that are mass assignable. | |
* | |
* @var array | |
*/ | |
protected $fillable = [ | |
'name', 'email', 'password', | |
]; | |
/** | |
* The attributes that should be hidden for arrays. | |
* | |
* @var array | |
*/ | |
protected $hidden = [ | |
'password', 'remember_token', | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment