insert imgs.
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Department extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
];
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany(User::class);
|
||||
}
|
||||
}
|
|
@ -50,7 +50,8 @@ class RegisterController extends Controller
|
|||
return Validator::make($data, [
|
||||
'name' => 'required|string|max:255',
|
||||
'email' => 'required|string|email|max:255|unique:users',
|
||||
'password' => 'required|string|min:6|confirmed'
|
||||
'password' => 'required|string|min:6|confirmed',
|
||||
'username' => 'required|string|email|max:255|unique:users'
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -65,7 +66,8 @@ class RegisterController extends Controller
|
|||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => bcrypt($data['password'])
|
||||
'password' => bcrypt($data['password']),
|
||||
'username' => $data['email']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ use Illuminate\Http\Request;
|
|||
define('YOUR_SERVER_URL', 'http://badmemory.test');
|
||||
// Check "oauth_clients" table for next 2 values:
|
||||
define('CLIENT_ID', '2');
|
||||
define('CLIENT_SECRET','KN0kCLNhCPFfjz8PTLqnaGU4Kn6qzu3ToRtcHIk5');
|
||||
define('CLIENT_SECRET','aSS3IeN5y7kSasdsArpbWpMLIdk1FMnEfYph2oAR');
|
||||
|
||||
class LoginControllerAPI extends Controller
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@ class UserControllerAPI extends Controller
|
|||
'password' => 'min:3'
|
||||
]);
|
||||
$user = new User();
|
||||
$user->username = $request->email;
|
||||
$user->fill($request->all());
|
||||
$user->password = Hash::make($user->password);
|
||||
$user->save();
|
||||
|
@ -50,6 +51,7 @@ class UserControllerAPI extends Controller
|
|||
'password' => 'min:3'
|
||||
]);
|
||||
$user = User::findOrFail($id);
|
||||
$user->username = $request->email;
|
||||
$user->update($request->all());
|
||||
return new UserResource($user);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class User extends Authenticatable
|
|||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'age',
|
||||
'username',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,7 @@ class InitialMigrations extends Migration
|
|||
{
|
||||
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->string('username')->unique();
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
|
|
|
@ -24,9 +24,11 @@ class UsersTableSeeder extends Seeder
|
|||
static $password;
|
||||
$createdAt = Carbon\Carbon::now()->subDays(30);
|
||||
$updatedAt = $faker->dateTimeBetween($createdAt);
|
||||
$emailUsername = $faker->unique()->safeEmail;
|
||||
return [
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'email' => $emailUsername,
|
||||
'username' => $emailUsername,
|
||||
'password' => $password ?: $password = bcrypt('secret'),
|
||||
'remember_token' => str_random(10),
|
||||
'created_at' => $createdAt,
|
||||
|
|
Before Width: | Height: | Size: 974 B After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 286 B |
After Width: | Height: | Size: 302 B |
|
@ -46787,8 +46787,12 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
|||
register: function register() {
|
||||
this.$router.push('/register');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
computed: function computed() {
|
||||
|
||||
this.$forceUpdate();
|
||||
}
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
|
@ -46995,7 +46999,7 @@ exports = module.exports = __webpack_require__(2)(false);
|
|||
|
||||
|
||||
// module
|
||||
exports.push([module.i, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", ""]);
|
||||
exports.push([module.i, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", ""]);
|
||||
|
||||
// exports
|
||||
|
||||
|
@ -47033,6 +47037,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
|||
message: function message() {
|
||||
return "Sure you want logout?";
|
||||
}
|
||||
//this.$forceUpdate();
|
||||
|
||||
},
|
||||
methods: {
|
||||
logout: function logout() {
|
||||
|
@ -47223,7 +47229,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
|||
axios.post('/api/register', {
|
||||
email: this.user.email,
|
||||
password: this.user.password,
|
||||
name: this.user.name
|
||||
name: this.user.name,
|
||||
username: this.user.email
|
||||
}).then(function (response) {
|
||||
console.log(response);
|
||||
_this.$router.push('/');
|
||||
|
@ -47234,8 +47241,11 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
|||
console.log('Login Error: ' + registerError);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: function computed() {
|
||||
|
||||
this.$forceUpdate();
|
||||
}
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
|
|
|
@ -64,6 +64,12 @@ export default {
|
|||
this.$router.push('/register');
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
computed() {
|
||||
|
||||
this.$forceUpdate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ export default {
|
|||
message(){
|
||||
return "Sure you want logout?";
|
||||
}
|
||||
//this.$forceUpdate();
|
||||
},
|
||||
methods: {
|
||||
logout() {
|
||||
|
|
|
@ -52,7 +52,8 @@ export default {
|
|||
axios.post('/api/register', {
|
||||
email : this.user.email,
|
||||
password : this.user.password,
|
||||
name : this.user.name
|
||||
name : this.user.name,
|
||||
username : this.user.email
|
||||
}).then(response => {
|
||||
console.log(response);
|
||||
this.$router.push('/');
|
||||
|
@ -65,6 +66,11 @@ export default {
|
|||
|
||||
});
|
||||
}
|
||||
},
|
||||
computed(){
|
||||
|
||||
this.$forceUpdate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,12 +4,13 @@
|
|||
|
||||
@section('content')
|
||||
<router-link to="/users">Users</router-link> -
|
||||
|
||||
@if(!Auth::user())
|
||||
<router-link to="/login">Login</router-link> -
|
||||
<router-link to="/register">Register</router-link> -
|
||||
|
||||
<router-link to="/logout">Logout</router-link> -
|
||||
|
||||
<router-link to="/register">Register</router-link> -
|
||||
@else
|
||||
<router-link to="/logout">Logout</router-link> -
|
||||
@endif
|
||||
<router-link to="/singletictactoe">SinglePlayer TicTacToe</router-link> -
|
||||
<router-link to="/multitictactoe">Multiplayer TicTacToe</router-link>
|
||||
|
||||
|
|