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');
}
};

View File

@@ -0,0 +1,23 @@
<?php
namespace Database\Seeders;
use App\Models\Author;
use Illuminate\Database\Seeder;
class AuthorSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Author::create([
'name' => 'EchoScoop Team',
'bio' => null,
'avatar' => null,
'enabled' => true, // Assuming you want this author to be enabled by default
'public' => true, // Assuming you want this author to be public by default
]);
}
}

View File

@@ -13,88 +13,90 @@ class CategorySeeder extends Seeder
public function run(): void
{
$categories = [
['name' => 'Automotive'],
['name' => 'Automotive', 'short_name' => 'Automotive'],
[
'name' => 'Business',
'short_name' => 'Business',
'children' => [
['name' => 'Trading'],
['name' => 'Information Technology'],
['name' => 'Marketing'],
['name' => 'Office'],
['name' => 'Telecommunications'],
['name' => 'Trading', 'short_name' => 'Trading'],
['name' => 'Information Technology', 'short_name' => 'IT'],
['name' => 'Marketing', 'short_name' => 'Marketing'],
['name' => 'Office', 'short_name' => 'Office'],
['name' => 'Telecommunications', 'short_name' => 'Telecom'],
],
],
[
'name' => 'Entertainment',
'children' => [
['name' => 'Dating'],
['name' => 'Film & Television'],
['name' => 'Games & Toys'],
['name' => 'Music and Video'],
['name' => 'Adult Entertainment'],
],
],
['name' => 'Food & Drink'],
['name' => 'Food & Drink', 'short_name' => 'Food'],
[
'name' => 'Hobbies & Gifts',
'short_name' => 'Hobbies',
'children' => [
['name' => 'Collectibles'],
['name' => 'Pets'],
['name' => 'Photography'],
['name' => 'Hunting & Fishing'],
['name' => 'Collectibles', 'short_name' => 'Collectibles'],
['name' => 'Pets', 'short_name' => 'Pets'],
['name' => 'Photography', 'short_name' => 'Photography'],
['name' => 'Hunting & Fishing', 'short_name' => 'Hunting'],
],
],
[
'name' => 'Education',
'children' => [
['name' => 'Languages'],
],
],
['name' => 'Law'],
['name' => 'Politics'],
['name' => 'Law', 'short_name' => 'Law'],
['name' => 'Politics', 'short_name' => 'Politics'],
[
'name' => 'Shopping',
'short_name' => 'Shopping',
'children' => [
['name' => 'Home & Garden'],
['name' => 'Clothing & Accessories'],
['name' => 'Computer & Electronics'],
['name' => 'Home & Garden', 'short_name' => 'Home'],
['name' => 'Fashion & Clothing', 'short_name' => 'Fashion'],
],
],
[
'name' => 'Religion & Spirituality',
'children' => [
['name' => 'Holistic Health'],
],
],
['name' => 'Real Estate'],
['name' => 'Social Networks'],
['name' => 'Real Estate', 'short_name' => 'Real Estate'],
[
'name' => 'Society',
'short_name' => 'Society',
'children' => [
['name' => 'Family'],
['name' => 'Wedding'],
['name' => 'Immigration'],
['name' => 'Family', 'short_name' => 'Family'],
['name' => 'Wedding', 'short_name' => 'Wedding'],
['name' => 'Immigration', 'short_name' => 'Immigration'],
[
'name' => 'Education',
'short_name' => 'Education',
'children' => [
['name' => 'Languages', 'short_name' => 'Languages'],
],
],
],
],
[
'name' => 'Wellness',
'short_name' => 'Wellness',
'children' => [
['name' => 'Health & Beauty'],
['name' => 'Psychology & Psychotherapy'],
['name' => 'Health', 'short_name' => 'Health'],
['name' => 'Beauty', 'short_name' => 'Beauty'],
['name' => 'Psychology', 'short_name' => 'Psychology'],
['name' => 'Religion & Spirituality', 'short_name' => 'Religion'],
],
],
[
'name' => 'Tips & Tricks',
'short_name' => 'Tips',
'children' => [
['name' => 'How to'],
['name' => 'How to', 'short_name' => 'How to'],
],
],
[
'name' => 'Travel',
'short_name' => 'Travel',
'children' => [
['name' => 'Holiday'],
['name' => 'World Festivals'],
['name' => 'Outdoors'],
['name' => 'Holiday', 'short_name' => 'Holiday'],
['name' => 'World Festivals', 'short_name' => 'Festivals'],
['name' => 'Outdoors', 'short_name' => 'Outdoors'],
],
],
[
'name' => 'Technology',
'short_name' => 'Tech',
'children' => [
['name' => 'Computer', 'short_name' => 'Computer'],
['name' => 'Phones', 'short_name' => 'Phones'],
['name' => 'Gadgets', 'short_name' => 'Gadgets'],
['name' => 'Social Networks', 'short_name' => 'Social Networks'],
],
],
];