Skip to content
Permalink
Browse files

initial database setup

  • Loading branch information...
darwinluague committed Mar 29, 2017
1 parent e35bb1f commit 5a66db1edd8b1c04c792989f15feda2a4877a2d7
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Tweet extends Model
{
//
}
@@ -22,3 +22,12 @@
'remember_token' => str_random(10),
];
});
$factory->define(App\Tweet::class, function (Faker\Generator $faker) {
return [
'user_id' => function () {
return factory(App\User::class)->create()->id;
},
'tweet' => $faker->sentence
];
});
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTweetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tweets', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id');
$table->string('tweet');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('tweets');
}
}
@@ -11,6 +11,6 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// $this->call(UsersTableSeeder::class);
$this->call(TweetsTableSeeder::class);
}
}
@@ -0,0 +1,16 @@
<?php
use Illuminate\Database\Seeder;
class TweetsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\Tweet::class, 50)->create();
}
}

0 comments on commit 5a66db1

Please sign in to comment.
You can’t perform that action at this time.