feat: add breath_hold & duration
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
<?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()
|
||||
{
|
||||
Schema::table('breathing_templates', function (Blueprint $table) {
|
||||
$table->integer('breath_hold')->default(0)->after('exhale');
|
||||
$table->integer('duration')->default(60)->after('breath_hold');
|
||||
$table->dropColumn('repeat'); // only if you are sure you no longer need it
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('breathing_templates', function (Blueprint $table) {
|
||||
$table->dropColumn(['breath_hold', 'duration']);
|
||||
$table->integer('repeat')->default(1); // rollback safety
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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::table('user_breathing_sessions', function (Blueprint $table) {
|
||||
$table ->integer('duration')->default(60)->after('template_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('user_breathing_sessions', function (Blueprint $table) {
|
||||
$table->dropColumn('duration');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -4,22 +4,84 @@
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\BreathingTemplate;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
class BreathingTemplateSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
BreathingTemplate::query()->delete();
|
||||
DB::statement('ALTER TABLE breathing_templates AUTO_INCREMENT = 1');
|
||||
$templates = [
|
||||
['name' => 'نفس آرام', 'inhale' => 4, 'exhale' => 4, 'repeat' => 5],
|
||||
['name' => 'نفس تمرکزی', 'inhale' => 3, 'exhale' => 3, 'repeat' => 8],
|
||||
['name' => 'نفس تسکین دهنده', 'inhale' => 6, 'exhale' => 6, 'repeat' => 10],
|
||||
['name' => 'نفس انرژی بخش', 'inhale' => 2, 'exhale' => 2, 'repeat' => 12],
|
||||
['name' => 'نفس عمیق', 'inhale' => 5, 'exhale' => 5, 'repeat' => 7],
|
||||
['name' => 'نفس آرامش بخش', 'inhale' => 4, 'exhale' => 6, 'repeat' => 6],
|
||||
['name' => 'نفس پاکسازی', 'inhale' => 3, 'exhale' => 5, 'repeat' => 8],
|
||||
['name' => 'نفس ذهنی', 'inhale' => 4, 'exhale' => 4, 'repeat' => 9],
|
||||
['name' => 'نفس کنترل استرس', 'inhale' => 5, 'exhale' => 7, 'repeat' => 6],
|
||||
['name' => 'نفس تمرینی', 'inhale' => 3, 'exhale' => 4, 'repeat' => 10],
|
||||
[
|
||||
'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) {
|
||||
|
||||
Reference in New Issue
Block a user