muchas cosas, aun esta en proceso de construccion
This commit is contained in:
11
database/factories/NowFactory.php
Normal file
11
database/factories/NowFactory.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/* @var $factory \Illuminate\Database\Eloquent\Factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Now::class, function (Faker $faker) {
|
||||
return [
|
||||
'md' => $faker->paragraphs(10, true)
|
||||
];
|
||||
});
|
||||
12
database/factories/PostFactory.php
Normal file
12
database/factories/PostFactory.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/* @var $factory \Illuminate\Database\Eloquent\Factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Post::class, function (Faker $faker) {
|
||||
return [
|
||||
'title' => $faker->words(5, true),
|
||||
'md' => $faker->paragraphs(10, true)
|
||||
];
|
||||
});
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
use App\User;
|
||||
use Illuminate\Support\Str;
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This directory should contain each of the model factory definitions for
|
||||
| your application. Factories provide a convenient way to generate new
|
||||
| model instances for testing / seeding your application's database.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(User::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
});
|
||||
30
database/migrations/2019_06_22_034600_create_base_db.php
Normal file
30
database/migrations/2019_06_22_034600_create_base_db.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateBaseDb extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('posts', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('title');
|
||||
$table->longText('md');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('now', function(Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->longText('md');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('now');
|
||||
Schema::dropIfExists('posts');
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,9 @@ use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call(UsersTableSeeder::class);
|
||||
$this->call(PostTableSeeder::class);
|
||||
$this->call(NowTableSeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
11
database/seeds/NowTableSeeder.php
Normal file
11
database/seeds/NowTableSeeder.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class NowTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
factory(App\Post::class, 50)->create();
|
||||
}
|
||||
}
|
||||
11
database/seeds/PostTableSeeder.php
Normal file
11
database/seeds/PostTableSeeder.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PostTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
factory(App\Post::class, 50)->create();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user