Add (article): ai gen, front views

This commit is contained in:
2023-09-24 22:53:40 +08:00
parent 18705bd5e4
commit 322d680961
115 changed files with 9710 additions and 201 deletions

View File

@@ -14,8 +14,11 @@ public function up(): void
Schema::create('categories', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('short_name');
$table->string('slug')->nullable();
$table->boolean('enabled')->default(true);
$table->bigInteger('counts')->default(0);
$table->timestamp('serp_at')->nullable();
$table->timestamps();
$table->nestedSet();
$table->index(['name', 'slug']);

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('news_serp_results', function (Blueprint $table) {
$table->id();
$table->foreignId('category_id')->nullable();
$table->string('category_name')->nullable();
$table->string('serp_provider');
$table->string('serp_se');
$table->string('serp_se_type');
$table->string('serp_keyword');
$table->string('serp_country_iso');
$table->decimal('serp_cost')->nullable();
$table->unsignedInteger('result_count')->nullable();
$table->string('filename');
$table->enum('status', ['initial'/* other potential statuses */]);
$table->timestamps();
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('news_serp_results');
}
};

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('serp_urls', function (Blueprint $table) {
$table->id();
$table->foreignId('news_serp_result_id');
$table->foreignId('category_id');
$table->string('category_name');
$table->string('source')->default('serp');
$table->string('url');
$table->string('country_iso');
$table->string('title')->nullable();
$table->text('description')->nullable();
$table->timestamp('serp_at')->nullable();
$table->enum('status', ['initial', 'processing', 'complete', 'failed', 'blocked', 'limited'])->default('initial');
$table->tinyInteger('process_status')->nullable();
$table->timestamps();
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
$table->foreign('news_serp_result_id')->references('id')->on('news_serp_results')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('serp_urls');
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('authors', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('avatar')->nullable();
$table->string('bio')->nullable();
$table->boolean('enabled')->default(true);
$table->boolean('public')->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('authors');
}
};

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->string('title')->nullable();
$table->string('short_title')->nullable();
$table->string('slug')->nullable();
$table->string('type')->nullable();
$table->string('main_keyword')->nullable();
$table->json('keywords')->nullable();
$table->mediumText('excerpt')->nullable();
$table->foreignId('author_id')->nullable();
$table->boolean('featured')->default(false);
$table->string('featured_image')->nullable();
$table->text('body')->nullable();
$table->integer('views_count')->default(0);
$table->enum('status', ['publish', 'future', 'draft', 'private', 'trash'])->default('draft');
$table->timestamp('published_at')->nullable();
$table->timestamps();
$table->foreign('author_id')->references('id')->on('authors');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('posts');
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('post_categories', function (Blueprint $table) {
$table->id();
$table->foreignId('post_id');
$table->foreignId('category_id');
$table->foreign('post_id')->references('id')->on('posts');
$table->foreign('category_id')->references('id')->on('categories');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('post_categories');
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
}
};