Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Schema::create('posts', function (Blueprint $table) {
- $table->increments('id');
- $table->integer('user_id')->unsigned();
- $table->string('title');
- $table->string('slug')->unique();
- $table->string('image')->default('default.png');
- $table->text('body');
- $table->boolean('is_approved')->default(false);
- $table->boolean('status')->default(false);
- $table->integer('view_count')->default(0);
- $table->foreign('user_id')
- ->references('id')->on('users')
- ->onDelete('cascade')->unsigned()->index();
- $table->timestamps();
- });
- Schema::create('users', function (Blueprint $table) {
- $table->increments('id');
- $table->integer('role_id')->default(2);
- $table->string('name');
- $table->string('username')->unique();
- $table->string('email')->unique();
- $table->string('image')->default('default.png');
- $table->timestamp('email_verified_at')->nullable();
- $table->string('password');
- $table->text('about')->nullable();
- $table->rememberToken();
- $table->timestamps();
- });
- Schema::table('post_users', function (Blueprint $table) {
- $table->integer('post_id')->unsigned();
- $table->integer('user_id');
- $table->foreign('post_id')
- ->references('id')->on('posts')
- ->onDelete('cascade')->unsigned()->index();
- });
Add Comment
Please, Sign In to add comment