// migartions/2014_10_12_000000_create_users_table.php
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('godruoyi_admin_user', function (Blueprint $table) {
$table->increments('id');
$table->string('nickname');
$table->string('username')->unique();
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('godruoyi_admin_user');
}
AuthController.php
/**
* 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',
'nickname' => 'required|max:255',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
return User::create([
'username' => $data['name'],
'email' => $data['email'],
'nickname' => $data['nickname'],
'password' => bcrypt($data['password']),
]);
}
config/auth.php
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
'table' => 'godruoyi_admin_user',
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
User model php file
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'username', 'email', 'password', 'nickname'
];
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'godruoyi_admin_user';
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
SO, I whant change default auth table ---users to godruoyi_admin_user, but it's no success,
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community