File size: 7,695 Bytes
5f32fbd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php

namespace Database\Seeders;

// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Helpers\Classes\InstallationHelper;
use App\Models\OpenAIGenerator;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class DatabaseSeeder extends Seeder
{
    public function run(): void
    {
        // run installation
        InstallationHelper::runInstallation();

        $this->call([
            IntroductionSeeder::class,
        ]);

        //        $this->call(
        //            MenuSeeder::class
        //        );

        //        $path = resource_path('/dev_tools/currency.sql');
        //        DB::unprepared(file_get_contents($path));
        //
        //        $path2 = resource_path('/dev_tools/openai_table.sql');
        //        DB::unprepared(file_get_contents($path2));
        //
        //        $path3 = resource_path('/dev_tools/openai_chat_categories_table.sql');
        //        DB::unprepared(file_get_contents($path3));
        //
        //        $path4 = resource_path('/dev_tools/openai_filters.sql');
        //        DB::unprepared(file_get_contents($path4));
        //
        //        $path5 = resource_path('/dev_tools/frontend_tools.sql');
        //        DB::unprepared(file_get_contents($path5));
        //
        //        $path6 = resource_path('/dev_tools/faq.sql');
        //        DB::unprepared(file_get_contents($path6));
        //
        //        $path7 = resource_path('/dev_tools/frontend_future.sql');
        //        DB::unprepared(file_get_contents($path7));
        //
        //        $path8 = resource_path('/dev_tools/howitworks.sql');
        //        DB::unprepared(file_get_contents($path8));
        //
        //        $path9 = resource_path('/dev_tools/testimonials.sql');
        //        DB::unprepared(file_get_contents($path9));
        //
        //        $path10 = resource_path('/dev_tools/frontend_who_is_for.sql');
        //        DB::unprepared(file_get_contents($path10));
        //
        //        $path11 = resource_path('/dev_tools/frontend_generators.sql');
        //        DB::unprepared(file_get_contents($path11));
        //
        //        $path12 = resource_path('/dev_tools/clients.sql');
        //        DB::unprepared(file_get_contents($path12));
        //
        //        $path13 = resource_path('/dev_tools/health_check_result_history_items.sql');
        //        DB::unprepared(file_get_contents($path13));
        //
        //        $path14 = resource_path('/dev_tools/email_templates.sql');
        //        DB::unprepared(file_get_contents($path14));
        //
        //        $path15 = resource_path('/dev_tools/ads.sql');
        //        DB::unprepared(file_get_contents($path15));
        //
        //        $path16 = resource_path('/dev_tools/ai_wizard.sql');
        //        DB::unprepared(file_get_contents($path16));
        //
        //        $path17 = resource_path('/dev_tools/ai_vision.sql');
        //        DB::unprepared(file_get_contents($path17));
        //
        //        $path18 = resource_path('/dev_tools/ai_vision2.sql');
        //        DB::unprepared(file_get_contents($path18));
        //
        //        $path19 = resource_path('/dev_tools/ai_pdf.sql');
        //        DB::unprepared(file_get_contents($path19));
        //
        //        $path20 = resource_path('/dev_tools/ai_pdf2.sql');
        //        DB::unprepared(file_get_contents($path20));
        //
        //        $path21 = resource_path('/dev_tools/ai_chat_image.sql');
        //        DB::unprepared(file_get_contents($path21));
        //
        //        $path22 = resource_path('/dev_tools/ai_chat_image2.sql');
        //        DB::unprepared(file_get_contents($path22));
        //
        //        $path23 = resource_path('/dev_tools/ai_rewriter.sql');
        //        DB::unprepared(file_get_contents($path23));
        //
        //        $path24 = resource_path('/dev_tools/team_email_templates.sql');
        //        DB::unprepared(file_get_contents($path24));
        //
        //        $path25 = resource_path('/dev_tools/ai_webchat.sql');
        //        DB::unprepared(file_get_contents($path25));
        //
        //        $path26 = resource_path('/dev_tools/ai_webchat2.sql');
        //        DB::unprepared(file_get_contents($path26));
        //
        //        $path27 = resource_path('/dev_tools/ai_filechat.sql');
        //        DB::unprepared(file_get_contents($path27));
        //
        //        $path28 = resource_path('/dev_tools/ai_filechat2.sql');
        //        DB::unprepared(file_get_contents($path28));
        //
        //        $path29 = resource_path('/dev_tools/ai_video.sql');
        //        DB::unprepared(file_get_contents($path29));
        //
        //        if (
        //            Schema::hasTable('plans')
        //            && Schema::hasColumn('plans', 'open_ai_items')
        //            && Schema::hasTable('openai')
        //        ) {
        //
        //            $openaiItems = \App\Models\OpenAIGenerator::query()->pluck('slug')->toArray();
        //
        //            $plans = \App\Models\PaymentPlans::query()->get();
        //
        //            foreach ($plans as $plan) {
        //                $plan->open_ai_items = $openaiItems;
        //                $plan->save();
        //            }
        //        }
        //
        //        if (
        //            Schema::hasTable('openai')
        //            && Schema::hasTable('settings')
        //            && Schema::hasColumn('settings', 'free_open_ai_items')
        //        ) {
        //            $openaiItems = \App\Models\OpenAIGenerator::query()->pluck('slug')->toArray();
        //            $setting = \App\Models\Setting::first();
        //
        //            $setting->update([
        //                'free_open_ai_items' => $openaiItems ?: [],
        //            ]);
        //        }
        //
        //        if (Schema::hasTable('pages')) {
        //            $customPages = \App\Models\Page::query()->where('is_custom', 1)->get();
        //            if ($customPages->count() == 0) {
        //                DB::unprepared(file_get_contents(resource_path('/dev_tools/inner_pages.sql')));
        //            }
        //        }
        //
        //        if (Schema::hasTable('openai')) {
        //            if (! OpenAIGenerator::where('slug', 'ai_voiceover')->exists()) {
        //                DB::unprepared(file_get_contents(resource_path('/dev_tools/ai_voiceover.sql')));
        //                DB::unprepared(file_get_contents(resource_path('/dev_tools/ai_filter_voiceover.sql')));
        //            }
        //        }
        //
        //        if (Schema::hasTable('openai')) {
        //            if (! OpenAIGenerator::where('slug', 'ai_youtube')->exists()) {
        //                DB::unprepared(file_get_contents(resource_path('/dev_tools/ai_youtube.sql')));
        //                DB::unprepared(file_get_contents(resource_path('/dev_tools/ai_filter_youtube.sql')));
        //            }
        //        }
        //
        //        if (Schema::hasTable('openai')) {
        //            if (! OpenAIGenerator::where('slug', 'ai_rss')->exists()) {
        //                DB::unprepared(file_get_contents(resource_path('/dev_tools/ai_rss.sql')));
        //                DB::unprepared(file_get_contents(resource_path('/dev_tools/ai_filter_rss.sql')));
        //            }
        //        }

        $this->command->info('Currency table seeded!');
    }
}