99 lines
2.9 KiB
PHP
99 lines
2.9 KiB
PHP
<?php
|
||
|
||
namespace Database\Seeders;
|
||
|
||
use Illuminate\Database\Seeder;
|
||
use App\Models\BreathingTemplate;
|
||
use Illuminate\Support\Facades\DB;
|
||
class BreathingTemplateSeeder extends Seeder
|
||
{
|
||
public function run(): void
|
||
{
|
||
BreathingTemplate::query()->delete();
|
||
|
||
$driver = DB::getDriverName();
|
||
|
||
if ($driver === 'mysql') {
|
||
DB::statement('ALTER TABLE breathing_templates AUTO_INCREMENT = 1');
|
||
} elseif ($driver === 'pgsql') {
|
||
DB::statement('ALTER SEQUENCE breathing_templates_id_seq RESTART WITH 1');
|
||
}
|
||
$templates = [
|
||
[
|
||
'name' => '۴-۷-۸ تنفس آرام',
|
||
'inhale' => 4,
|
||
'exhale' => 8,
|
||
'breath_hold' => 7,
|
||
'duration' => 60
|
||
],
|
||
[
|
||
'name' => 'تنفس جعبهای (Box Breathing)',
|
||
'inhale' => 4,
|
||
'exhale' => 4,
|
||
'breath_hold' => 4,
|
||
'duration' => 60
|
||
],
|
||
[
|
||
'name' => 'تنفس هماهنگ (Coherent Breathing)',
|
||
'inhale' => 5,
|
||
'exhale' => 5,
|
||
'breath_hold' => 0,
|
||
'duration' => 60
|
||
],
|
||
[
|
||
'name' => 'تنفس آرام عمیق',
|
||
'inhale' => 6,
|
||
'exhale' => 6,
|
||
'breath_hold' => 0,
|
||
'duration' => 90
|
||
],
|
||
[
|
||
'name' => 'تنفس تمرکزی ساده',
|
||
'inhale' => 4,
|
||
'exhale' => 4,
|
||
'breath_hold' => 0,
|
||
'duration' => 60
|
||
],
|
||
[
|
||
'name' => 'تنفس برای کاهش استرس',
|
||
'inhale' => 5,
|
||
'exhale' => 7,
|
||
'breath_hold' => 0,
|
||
'duration' => 120
|
||
],
|
||
[
|
||
'name' => 'تنفس پاکسازی',
|
||
'inhale' => 3,
|
||
'exhale' => 5,
|
||
'breath_hold' => 0,
|
||
'duration' => 60
|
||
],
|
||
[
|
||
'name' => 'تنفس ذهنی کوتاه',
|
||
'inhale' => 4,
|
||
'exhale' => 4,
|
||
'breath_hold' => 0,
|
||
'duration' => 30
|
||
],
|
||
[
|
||
'name' => 'تنفس خوابآور ۴-۷-۸',
|
||
'inhale' => 4,
|
||
'exhale' => 8,
|
||
'breath_hold' => 7,
|
||
'duration' => 120
|
||
],
|
||
[
|
||
'name' => 'تنفس تجدید انرژی',
|
||
'inhale' => 2,
|
||
'exhale' => 4,
|
||
'breath_hold' => 0,
|
||
'duration' => 45
|
||
],
|
||
];
|
||
|
||
foreach ($templates as $template) {
|
||
BreathingTemplate::create($template);
|
||
}
|
||
}
|
||
}
|