aboutsummaryrefslogtreecommitdiff
path: root/database
diff options
context:
space:
mode:
authorCamil Staps2016-09-25 23:56:46 +0200
committerCamil Staps2016-09-26 01:02:05 +0200
commit33ad0c14d168d36a4e7ad42dc6aa6a37a7335849 (patch)
tree0543b7d92f7f0b7706f4313ba10b18483f747798 /database
parentAdded unique visitors to statistics (diff)
Change from lumen 5.2 to laravel 5.3 (Resolves #1)
Diffstat (limited to 'database')
-rw-r--r--database/factories/ModelFactory.php8
-rw-r--r--database/migrations/2016_09_25_210947_add_remember_token.php32
-rw-r--r--database/migrations/2016_09_25_230620_create_password_resets_table.php32
3 files changed, 69 insertions, 3 deletions
diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php
index ae7165b..e0dc869 100644
--- a/database/factories/ModelFactory.php
+++ b/database/factories/ModelFactory.php
@@ -11,11 +11,13 @@
|
*/
-$factory->define(App\User::class, function ($faker) {
+$factory->define(App\User::class, function (Faker\Generator $faker) {
+ static $password;
+
return [
'name' => $faker->name,
- 'email' => $faker->email,
- 'password' => str_random(10),
+ 'email' => $faker->unique()->safeEmail,
+ 'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
];
});
diff --git a/database/migrations/2016_09_25_210947_add_remember_token.php b/database/migrations/2016_09_25_210947_add_remember_token.php
new file mode 100644
index 0000000..83f72bd
--- /dev/null
+++ b/database/migrations/2016_09_25_210947_add_remember_token.php
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddRememberToken extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('users', function (Blueprint $table) {
+ $table->rememberToken();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('users', function (Blueprint $table) {
+ $table->dropColumn('remember_token');
+ });
+ }
+}
diff --git a/database/migrations/2016_09_25_230620_create_password_resets_table.php b/database/migrations/2016_09_25_230620_create_password_resets_table.php
new file mode 100644
index 0000000..bda733d
--- /dev/null
+++ b/database/migrations/2016_09_25_230620_create_password_resets_table.php
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreatePasswordResetsTable extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::create('password_resets', function (Blueprint $table) {
+ $table->string('email')->index();
+ $table->string('token')->index();
+ $table->timestamp('created_at')->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::drop('password_resets');
+ }
+}