182 lines
6.5 KiB
PHP
182 lines
6.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('achievements', function (Blueprint $table): void {
|
|
$table->id();
|
|
$table->string('name');
|
|
$table->string('slug')->unique();
|
|
$table->string('description');
|
|
$table->string('icon', 80);
|
|
$table->unsignedInteger('xp_reward')->default(0);
|
|
$table->string('type', 40);
|
|
$table->string('condition_type', 40);
|
|
$table->unsignedInteger('condition_value');
|
|
$table->timestamps();
|
|
|
|
$table->index(['type', 'condition_type']);
|
|
});
|
|
|
|
DB::table('achievements')->insert([
|
|
[
|
|
'name' => 'First Upload',
|
|
'slug' => 'first-upload',
|
|
'description' => 'Publish your first artwork.',
|
|
'icon' => 'fa-image',
|
|
'xp_reward' => 100,
|
|
'type' => 'Uploads',
|
|
'condition_type' => 'upload_count',
|
|
'condition_value' => 1,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'name' => '10 Uploads',
|
|
'slug' => 'ten-uploads',
|
|
'description' => 'Publish 10 artworks.',
|
|
'icon' => 'fa-layer-group',
|
|
'xp_reward' => 250,
|
|
'type' => 'Uploads',
|
|
'condition_type' => 'upload_count',
|
|
'condition_value' => 10,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'name' => '100 Uploads',
|
|
'slug' => 'hundred-uploads',
|
|
'description' => 'Publish 100 artworks.',
|
|
'icon' => 'fa-fire',
|
|
'xp_reward' => 1200,
|
|
'type' => 'Uploads',
|
|
'condition_type' => 'upload_count',
|
|
'condition_value' => 100,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'name' => 'First Like Received',
|
|
'slug' => 'first-like-received',
|
|
'description' => 'Receive your first artwork like.',
|
|
'icon' => 'fa-heart',
|
|
'xp_reward' => 75,
|
|
'type' => 'Engagement',
|
|
'condition_type' => 'likes_received',
|
|
'condition_value' => 1,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'name' => '100 Likes',
|
|
'slug' => 'hundred-likes-received',
|
|
'description' => 'Receive 100 artwork likes.',
|
|
'icon' => 'fa-heart-circle-check',
|
|
'xp_reward' => 300,
|
|
'type' => 'Engagement',
|
|
'condition_type' => 'likes_received',
|
|
'condition_value' => 100,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'name' => '1000 Likes',
|
|
'slug' => 'thousand-likes-received',
|
|
'description' => 'Receive 1000 artwork likes.',
|
|
'icon' => 'fa-heart-circle-bolt',
|
|
'xp_reward' => 1500,
|
|
'type' => 'Engagement',
|
|
'condition_type' => 'likes_received',
|
|
'condition_value' => 1000,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'name' => 'First Follower',
|
|
'slug' => 'first-follower',
|
|
'description' => 'Earn your first follower.',
|
|
'icon' => 'fa-user-plus',
|
|
'xp_reward' => 100,
|
|
'type' => 'Social',
|
|
'condition_type' => 'followers_count',
|
|
'condition_value' => 1,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'name' => '100 Followers',
|
|
'slug' => 'hundred-followers',
|
|
'description' => 'Earn 100 followers.',
|
|
'icon' => 'fa-users',
|
|
'xp_reward' => 500,
|
|
'type' => 'Social',
|
|
'condition_type' => 'followers_count',
|
|
'condition_value' => 100,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'name' => 'First Story',
|
|
'slug' => 'first-story',
|
|
'description' => 'Publish your first story.',
|
|
'icon' => 'fa-feather-pointed',
|
|
'xp_reward' => 100,
|
|
'type' => 'Stories',
|
|
'condition_type' => 'stories_published',
|
|
'condition_value' => 1,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'name' => '10 Stories',
|
|
'slug' => 'ten-stories',
|
|
'description' => 'Publish 10 stories.',
|
|
'icon' => 'fa-book-open-reader',
|
|
'xp_reward' => 350,
|
|
'type' => 'Stories',
|
|
'condition_type' => 'stories_published',
|
|
'condition_value' => 10,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'name' => 'Reached Level 5',
|
|
'slug' => 'level-five',
|
|
'description' => 'Reach level 5 in the XP system.',
|
|
'icon' => 'fa-star',
|
|
'xp_reward' => 400,
|
|
'type' => 'Milestones',
|
|
'condition_type' => 'level_reached',
|
|
'condition_value' => 5,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'name' => 'Reached Level 7',
|
|
'slug' => 'level-seven',
|
|
'description' => 'Reach level 7 in the XP system.',
|
|
'icon' => 'fa-crown',
|
|
'xp_reward' => 1200,
|
|
'type' => 'Milestones',
|
|
'condition_type' => 'level_reached',
|
|
'condition_value' => 7,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
]);
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('achievements');
|
|
}
|
|
};
|