trash removed

This commit is contained in:
Anatoliy Poloz
2024-01-22 11:53:19 +03:00
parent 1755916744
commit ed9b7f1ccf
75 changed files with 0 additions and 2700 deletions

1
database/.gitignore vendored
View File

@@ -1 +0,0 @@
*.sqlite*

View File

@@ -1,47 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\BlogPost;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\BlogPost>
*/
class BlogPostFactory extends Factory
{
protected $model = BlogPost::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
$imagePath = storage_path('app/public');
$curImage = $this->faker->image($imagePath.'/blog_posts', 360, 360, 'animals', true, true, 'cats', true, 'jpg');
$curImage = Str::replace($imagePath, '', $curImage);
return [
'state' => $this->faker->randomElement(['active', 'archived']),
'image' => $curImage,
'description' => $this->faker->realText($this->faker->numberBetween(100, 200)),
'youtube_url' => $this->faker->url(),
'created_at' => $this->faker->dateTimeBetween('-1 week', '+1 week'),
'updated_at' => $this->faker->dateTimeBetween('-1 week', '+1 week'),
'title' => $this->faker->realText($this->faker->numberBetween(10, 20)),
];
}
public function some()
{
User::orderBy('created_at', 'desc')->limit(20)->get()->map(function ($user) {
$newBlogPosts = BlogPost::factory()->count(3)->create();
$newBlogPosts->map(function ($post) use ($user) {
$user->author_of_blog_post()->attach($post->id);
});
});
}
}

View File

@@ -1,32 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\Diary;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Diary>
*/
class DiaryFactory extends Factory
{
protected $model = Diary::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
'user_id' => User::factory(),
'date' => $this->faker->date('Y-m-d'),
'wakeup' => '06:30:00',
'retire' => '22:30:00',
'comment' => 'some comment for tests',
'closed' => false,
];
}
}

View File

@@ -1,89 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use FakerRestaurant\Provider\en_US\Restaurant;
use App\Models\Diet;
use App\Models\User;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Illuminate\Http\File;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Diet>
*/
class DietFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$faker = \Faker\Factory::create();
$this->faker->addProvider(new Restaurant($faker));
$dietDuration = $this->faker->randomElement([7, 14, 21]);
$dietState = $this->faker->randomElement(['active','draft','archived']);
$numberOfDefinedDietTypes = $this->faker->numberBetween(1, 4);
$expectedDietTypes = ['meat', 'veg', 'corb', 'alko'];
$selectedDietTypes = $this->faker->randomElements($expectedDietTypes, $numberOfDefinedDietTypes);
$dietTypes = array_reduce(
$selectedDietTypes,
function($acc, $el) {
$acc[$el] = true;
return $acc;
},
[]
);
$dietEatingTypes = ['breakfast', 'dinner', 'supper', 'lunch', 'snacks'];
$dailySchedule = [];
$images = ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg', '7.png', '8.png', '9.jpg', '10.png'];
Storage::fake('diets');
$imageFileKey = $this->faker->numberBetween(0, 9);
$imageFilePath = 'database/assets/images/diets/' . $images[$imageFileKey];
$file = new File($imageFilePath);
$fileLocalPath = Storage::putFile('diets', $file, 'public');
for($day = 1; $day <= $dietDuration ; $day++) {
foreach($dietEatingTypes as $eatingType) {
$numberOfProductsInCurrentMeel = $this->faker->numberBetween(1, 4);
for(;$numberOfProductsInCurrentMeel > 0; $numberOfProductsInCurrentMeel--) {
$meelName = $this->faker->foodName();
$dailySchedule[$day][$eatingType][] = [
'name' => $meelName,
'quantity' => $this->faker->numberBetween(1, 1000),
'portion' => $this->faker->randomElement(['grams', 'pcs', 'milliliters']),
'uniq' => $meelName . '-' . time(),
];
}
}
}
$dietName = $this->faker->randomElement([
$this->faker->foodName(),
$this->faker->beverageName(),
$this->faker->dairyName(),
$this->faker->vegetableName(),
$this->faker->fruitName(),
$this->faker->meatName(),
$this->faker->sauceName(),
]);
$dietNamePrefix = $this->faker->randomElement(['Super', 'Keto', 'Fast', 'Detox', 'Power Of', 'Green', 'Healthy', 'Turbo']);
return [
'name' => $dietNamePrefix . " " . $dietName . " Diet",
'duration' => $dietDuration,
'state' => $dietState,
'image' => $fileLocalPath,
'type' => $dietTypes,
'details' => $this->faker->paragraph(3, true),
'daily_schedule' => $dailySchedule
];
}
}

View File

@@ -1,26 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\PlanComment>
*/
class PlanCommentFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'grade' => $this->faker->randomDigit(),
'body' => $this->faker->text(),
];
}
}

View File

@@ -1,79 +0,0 @@
<?php
namespace Database\Factories;
use FakerRestaurant\Provider\en_US\Restaurant;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Plan>
*/
class PlanFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$faker = \Faker\Factory::create();
$this->faker->addProvider(new Restaurant($faker));
$active = $this->faker->boolean();
$typeBody = [
'fit' => $this->faker->boolean(),
'slim' => $this->faker->boolean(),
'behavior' => $this->faker->boolean(),
'wellness' => $this->faker->boolean(),
];
$wrongTypeBody = json_encode($typeBody);
$packetsOptions1 = [
'items' => [$this->faker->fruitName(), $this->faker->meatName(), $this->faker->sauceName()],
'price' => $this->faker->randomNumber(),
'short' => $this->faker->foodName(),
'description' => $this->faker->text(),
];
$packetsOptions2 = [
'items' => [$this->faker->fruitName(), $this->faker->meatName(), $this->faker->sauceName()],
'price' => $this->faker->randomNumber(),
'short' => $this->faker->foodName(),
'description' => $this->faker->text(),
];
$packetsOptions3 = [
'items' => [$this->faker->fruitName(), $this->faker->meatName(), $this->faker->sauceName()],
'price' => $this->faker->randomNumber(),
'short' => $this->faker->foodName(),
'description' => $this->faker->text(),
];
Storage::fake('plans');
$file = UploadedFile::fake()->image('plan.png');
$fileLocalPath = $file->store('plans', 'public');
return [
'name' => $this->faker->foodName(),
// 'image' => UploadedFile::fake()->image('plans/Photo_C.png'),
'image' => $fileLocalPath,
'duration' => $this->faker->randomElement([7, 14, 21]),
'state' => $this->faker->randomElement(['active', 'draft', 'unactive']),
//'type' => $this->faker->randomElement([$typeBody, $wrongTypeBody]),
'type' => $typeBody,
'details' => $this->faker->text(),
'packets_count' => $this->faker->randomElement([1, 3]),
'packet1_options' => $packetsOptions1,
'packet2_options' => $active ? $packetsOptions2 : '',
'packet3_options' => $active ? $packetsOptions3 : '',
];
}
}

View File

@@ -1,50 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\User;
use App\Models\UserDetailz;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\UserDetailz>
*/
class UserDetailzFactory extends Factory
{
protected $model = UserDetailz::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
// 'user_id' => User::factory(),
'first_name' => $this->faker->name(),
'last_name' => $this->faker->name(),
'birthdate' => $this->faker->date('Y-m-d'),
'gender' => $this->faker->randomElement(['male', 'female']),
'country' => $this->faker->countryCode(),
'city' => $this->faker->randomElement(['Moscow', 'Kyev', 'New-York', 'Minsk']),
'lang' => $this->faker->languageCode(),
'weight' => $this->faker->numberBetween(90, 200),
'chest_circumference' => $this->faker->randomNumber(2, true),
'waist_circumference' => $this->faker->randomNumber(2, true),
'hip_circumference' => $this->faker->randomNumber(2, true),
'blood_pressure_up' => $this->faker->randomNumber(3, true),
'blood_pressure_down' => $this->faker->randomNumber(3, true),
'has_hypo' => $this->faker->randomElement(['0', '1']),
'has_hyper' => $this->faker->randomElement(['0', '1']),
'about_alergy' => $this->faker->text(),
'about_taking_pils' => $this->faker->text(),
'about_sport_hobbies' => $this->faker->text(),
'favorite_foods' => $this->faker->text(),
'unfavorite_foods' => $this->faker->text(),
'additional_info' => $this->faker->text(),
'is_mood_fillable' => $this->faker->boolean(),
'is_bedtime_fillable' => $this->faker->boolean(),
];
}
}

View File

@@ -1,69 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\Team;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use Laravel\Jetstream\Features;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'two_factor_secret' => null,
'two_factor_recovery_codes' => null,
'remember_token' => Str::random(10),
'profile_photo_path' => null,
'current_team_id' => null,
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
/**
* Indicate that the user should have a personal team.
*/
public function withPersonalTeam(?callable $callback = null): static
{
if (! Features::hasTeamFeatures()) {
return $this->state([]);
}
return $this->has(
Team::factory()
->state(fn (array $attributes, User $user) => [
'name' => $user->name.'\'s Team',
'user_id' => $user->id,
'personal_team' => true,
])
->when(is_callable($callback), $callback),
'ownedTeams'
);
}
}

View File

@@ -1,34 +0,0 @@
<?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('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->foreignId('current_team_id')->nullable();
$table->string('profile_photo_path', 2048)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
};

View File

@@ -1,46 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Laravel\Fortify\Fortify;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->text('two_factor_secret')
->after('password')
->nullable();
$table->text('two_factor_recovery_codes')
->after('two_factor_secret')
->nullable();
if (Fortify::confirmsTwoFactorAuthentication()) {
$table->timestamp('two_factor_confirmed_at')
->after('two_factor_recovery_codes')
->nullable();
}
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(array_merge([
'two_factor_secret',
'two_factor_recovery_codes',
], Fortify::confirmsTwoFactorAuthentication() ? [
'two_factor_confirmed_at',
] : []));
});
}
};

View File

@@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
};

View File

@@ -1,33 +0,0 @@
<?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('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->text('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sessions');
}
};

View File

@@ -1,53 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_detailzs', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id')->nullable();
$table->string('first_name', 256)->default('');
$table->string('last_name', 256)->default('');
$table->date('birthdate')->default('1980-01-01')->nullable(false);
$table->string('gender')->default('');
$table->string('country')->default('');
$table->string('city')->default('');
$table->string('lang')->default('');
$table->smallInteger('weight')->default(0);
$table->smallInteger('chest_circumference')->default(0);
$table->smallInteger('waist_circumference')->default(0);
$table->smallInteger('hip_circumference')->default(0);
$table->smallInteger('blood_pressure_up')->default(0);
$table->smallInteger('blood_pressure_down')->default(0);
$table->boolean('has_hypo')->default(false);
$table->boolean('has_hyper')->default(false);
$table->text('about_alergy');
$table->text('about_taking_pils');
$table->text('about_sport_hobbies');
$table->text('favorite_foods');
$table->text('unfavorite_foods');
$table->text('additional_info');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_detailzs');
}
};

View File

@@ -1,42 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('diaries', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')
->nullable()
->constrained()
->onUpdate('cascade')
->onDelete('cascade');
/* $table->unsignedBigInteger('user_id'); */
$table->date('date');
$table->time('wakeup');
$table->time('retire');
$table->timestamps();
/* $table->foreign('user_id')->references('id')->on('users'); */
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('diaries');
}
};

View File

@@ -1,45 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('meals', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')
->nullable()
->constrained('users')
->onUpdate('cascade')
->onDelete('cascade');
$table->foreignId('diary_id')
->nullable()
->constrained('diaries')
->onUpdate('cascade')
->onDelete('cascade');
$table->time('time');
$table->unsignedTinyInteger('type');
$table->tinyInteger('satiety');
$table->tinyInteger('mood');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('meals');
}
};

View File

@@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('portions', function (Blueprint $table) {
$table->id();
$table->foreignId('meal_id')
->constrained('meals')
->onUpdate('cascade')
->onDelete('cascade');
$table->string('product_name');
$table->string('portion');
$table->smallInteger('quantity');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('portions');
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('diaries', function (Blueprint $table) {
$table->boolean('closed')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('diaries', function (Blueprint $table) {
$table->dropColumn('closed');
});
}
};

View File

@@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('calendars', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('calendars');
}
};

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('circumference_measures', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->smallInteger('chest_circumference')->default(0);
$table->smallInteger('waist_circumference')->default(0);
$table->smallInteger('hip_circumference')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('circumference_measures');
}
};

View File

@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('weight_measures', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->smallInteger('weight')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('weight_measures');
}
};

View File

@@ -1,39 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('consultant_education', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->json('completed_courses');
$table->boolean('has_medical_education')->default(false);
$table->string('vk_link')->default('');
$table->string('insta_link')->default('');
$table->string('fb_link')->default('');
$table->string('tg_link')->default('');
$table->string('request_state')->default('');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('consultant_education');
}
};

View File

@@ -1,37 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_attachments', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->string('group')->default('user_files');
$table->string('original_name');
$table->string('path');
$table->integer('size')->default(0);
$table->json('specs');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_attachments');
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('is_consultant')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('is_consultant');
});
}
};

View File

@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('meal_user_attachment', function (Blueprint $table) {
$table->id();
$table->bigInteger('meal_id');
$table->bigInteger('user_attachment_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('meal_user_attachment');
}
};

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('consultant_diary_comments', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id')->comment('consultant id');
$table->bigInteger('diary_id');
$table->string('comment_type', 128);
$table->text('comment');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('consultant_diary_comments');
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('diaries', function (Blueprint $table) {
$table->text('comment');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('diaries', function (Blueprint $table) {
$table->dropColumn('comment');
});
}
};

View File

@@ -1,41 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('plans', function (Blueprint $table) {
$table->id();
$table->string('name')->comment('name of plan');
$table->string('image')->nullable()->comment('public path to image');
$table->smallInteger('duration')->comment('plan duration - 7, 14, 21 days');
$table->string('state')->comment('active/draft/archived');
$table->json('type')->comment('to lose weight, to gain weight, to improve your mood, to shape your eating behavior');
$table->text('details')->comment('plan details');
$table->tinyInteger('packets_count')->comment('1 on 3 packets of options in plan');
$table->json('packet1_options');
$table->json('packet2_options');
$table->json('packet3_options');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('plans');
}
};

View File

@@ -1,26 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create('rich_texts', function (Blueprint $table) {
$table->id();
$table->morphs('record');
$table->string('field');
$table->longText('body')->nullable();
$table->timestamps();
$table->unique(['field', 'record_type', 'record_id']);
});
}
public function down()
{
Schema::dropIfExists('rich_texts');
}
};

View File

@@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('plan_author', function (Blueprint $table) {
$table->bigInteger('user_id');
$table->bigInteger('plan_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('plan_author');
}
};

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('plan_comments', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->bigInteger('plan_id');
$table->smallInteger('grade')->default(0);
$table->longText('body')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('plan_comments');
}
};

View File

@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('plan_likes', function (Blueprint $table) {
$table->id();
$table->foreignId('plan_id');
$table->foreignId('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('plan_likes');
}
};

View File

@@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('comment_upvotes', function (Blueprint $table) {
$table->id();
$table->foreignId('comment_id');
$table->foreignId('user_id');
$table->string('type')->default('upvote');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('comment_upvotes');
}
};

View File

@@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('diets', function (Blueprint $table) {
$table->id();
$table->string('name')->comment('name of diet');
$table->string('image')->nullable()->comment('public path to image');
$table->smallInteger('duration')->comment('diet duration - 7, 14, 28 days');
$table->string('state')->comment('active/draft/archived');
$table->json('type')->comment('has meat/vegs/carb/alcohol');
$table->text('details')->comment('diet details');
$table->json('daily_schedule')->comment('A list of planned foods');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('diets');
}
};

View File

@@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('diet_author', function (Blueprint $table) {
$table->bigInteger('user_id');
$table->bigInteger('diet_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('diet_author');
}
};

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('diet_comments', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->bigInteger('diet_id');
$table->smallInteger('grade')->default(0);
$table->longText('body')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('diet_comments');
}
};

View File

@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('diet_likes', function (Blueprint $table) {
$table->id();
$table->foreignId('diet_id');
$table->foreignId('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('diet_likes');
}
};

View File

@@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('diet_comment_upvotes', function (Blueprint $table) {
$table->id();
$table->foreignId('comment_id');
$table->foreignId('user_id');
$table->string('type')->default('upvote');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('diet_comment_upvotes');
}
};

View File

@@ -1,62 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateViewsTable extends Migration
{
/**
* The database schema.
*
* @var \Illuminate\Support\Facades\Schema
*/
protected $schema;
/**
* The table name.
*
* @var string
*/
protected $table;
/**
* Create a new migration instance.
*
* @return void
*/
public function __construct()
{
$this->schema = Schema::connection(
config('eloquent-viewable.models.view.connection')
);
$this->table = config('eloquent-viewable.models.view.table_name');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create($this->table, function (Blueprint $table) {
$table->bigIncrements('id');
$table->morphs('viewable');
$table->text('visitor')->nullable();
$table->string('collection')->nullable();
$table->timestamp('viewed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists($this->table);
}
}

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('chosen_plans', function (Blueprint $table) {
$table->id();
$table->foreignId('plan_id')->nullable();
$table->foreignId('user_id')->unique();
$table->string('last_state')->default('inited'); // requested->paid->started->finished, requested->paid->started->rejected, requested->rejected
$table->timestamp('start_date')->useCurrent();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('chosen_plans');
}
};

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('chosen_diets', function (Blueprint $table) {
$table->id();
$table->foreignId('diet_id')->nullable();
$table->foreignId('user_id')->unique();
$table->string('last_state')->default('inited'); // started->finished, started->rejected
$table->timestamp('start_date')->useCurrent();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('chosen_diets');
}
};

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateStateHistoryTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('state_history', function (Blueprint $table) {
$table->increments('id');
$table->string('transition');
$table->string('from');
$table->string('to');
$table->integer('actor_id')->nullable();
$table->morphs('statable');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('state_history');
}
}

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blog_posts', function (Blueprint $table) {
$table->id();
$table->string('state')->default('archived')->comment('active/archived');
$table->string('image')->default('')->comment('public path to image');
$table->text('description');
$table->string('youtube_url')->default('');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('blog_posts');
}
};

View File

@@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('recipes', function (Blueprint $table) {
$table->id();
$table->string('image')->default('')->comment('public path to image');
$table->string('state')->comment('active/archived');
$table->integer('cooking_time')->default(0);
$table->json('ingredients');
$table->text('description');
$table->json('steps');
$table->string('youtube_url')->default('');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('recipes');
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tags', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('tags');
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('taggables', function (Blueprint $table) {
$table->id();
$table->integer('tag_id');
$table->morphs('taggable');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('taggables');
}
};

View File

@@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blog_post_author', function (Blueprint $table) {
$table->bigInteger('user_id');
$table->bigInteger('blog_post_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('blog_post_author');
}
};

View File

@@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('recipe_author', function (Blueprint $table) {
$table->bigInteger('user_id');
$table->bigInteger('recipe_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('recipe_author');
}
};

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blog_post_comments', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->bigInteger('blog_post_id');
$table->smallInteger('grade')->default(0);
$table->longText('body')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('blog_post_comments');
}
};

View File

@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blog_post_likes', function (Blueprint $table) {
$table->id();
$table->foreignId('blog_post_id');
$table->foreignId('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('blog_post_likes');
}
};

View File

@@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blog_post_comment_upvotes', function (Blueprint $table) {
$table->id();
$table->foreignId('blog_post_comment_id');
$table->foreignId('user_id');
$table->string('type')->default('upvote');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('blog_post_comment_upvotes');
}
};

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('recipe_comments', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->bigInteger('recipe_id');
$table->smallInteger('grade')->default(0);
$table->longText('body')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('recipe_comments');
}
};

View File

@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('recipe_likes', function (Blueprint $table) {
$table->id();
$table->foreignId('recipe_id');
$table->foreignId('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('recipe_likes');
}
};

View File

@@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('recipe_comment_upvotes', function (Blueprint $table) {
$table->id();
$table->foreignId('recipe_comment_id');
$table->foreignId('user_id');
$table->string('type')->default('upvote');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('recipe_comment_upvotes');
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('blog_posts', function (Blueprint $table) {
$table->string('title', 512)->default('');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('blog_posts', function (Blueprint $table) {
$table->dropColumn('title');
});
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('recipes', function (Blueprint $table) {
$table->string('title', 512)->default('');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('recipes', function (Blueprint $table) {
$table->dropColumn('title');
});
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('recipes', function (Blueprint $table) {
$table->renameColumn('youtube_url', 'video_url');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('recipes', function (Blueprint $table) {
$table->renameColumn('video_url', 'youtube_url');
});
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('recipes', function (Blueprint $table) {
$table->string('type', 512)->default('unknown');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('recipes', function (Blueprint $table) {
$table->dropColumn('type');
});
}
};

View File

@@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('chats', function (Blueprint $table) {
$table->id();
$table->foreignId('from_user_id');
$table->foreignId('to_user_id');
$table->text('data');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('chats');
}
};

View File

@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('product_groups', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description')->nullable('')->default('');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('product_groups');
}
};

View File

@@ -1,45 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('product_nutritional_values', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->string('image')->nullable()->default('');
$table->foreignId('product_group_id');
$table->string('description', 4096);
$table->string('formulations', 4096);
$table->integer('energy_on_100gr');
$table->float('proteins_on_100gr', 8, 2);
$table->float('fats_on_100gr', 8, 2);
$table->float('carbohydrates_on_100gr', 8, 2);
$table->integer('portion_mass_gr')->nullable(0);
$table->float('energy_on_portion', 8, 2)->nullable(0);
$table->float('proteins_on_portion', 8, 2)->nullable(0);
$table->float('fats_on_portion', 8, 2)->nullable(0);
$table->float('carbohydrates_on_portion', 8, 2)->nullable(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('product_nutritional_values');
}
};

View File

@@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('finances', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('finances');
}
};

View File

@@ -1,28 +0,0 @@
<?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_detailzs', function (Blueprint $table) {
$table->integer('height')->comment('user height in centimeters')->default(170)->after('weight');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('user_detailzs', function (Blueprint $table) {
$table->dropColumn('height');
});
}
};

View File

@@ -1,30 +0,0 @@
<?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_detailzs', function (Blueprint $table) {
$table->boolean('is_mood_fillable');
$table->boolean('is_bedtime_fillable');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('user_detailzs', function (Blueprint $table) {
$table->dropColumn('is_mood_fillable');
$table->dropColumn('is_bedtime_fillable');
});
}
};

View File

@@ -1,28 +0,0 @@
<?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('users', function (Blueprint $table) {
$table->boolean('is_public_profile')->default(1)->comment('0 only friends, 1 all');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('is_public_profile');
});
}
};

View File

@@ -1,46 +0,0 @@
<?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('consultant_legal_entities', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained(
table: 'users',
indexName: 'consultant_legal_entities_user_id'
);
$table->string('type')->default('selfemployed')->comment('ip|selfemployed|ltd');
$table->string('inn')->default('')->comment('ИНН');
$table->string('egrip')->default('')->comment('Номер записи в ЕГРИП для ИП');
$table->string('ltd_name', 2048)->default('')->comment('Название OOO');
$table->string('ltd_kpp')->default('')->comment('КПП ООО');
$table->string('ltd_ogrn')->default('')->comment('ОГРН ООО');
$table->string('ltd_legal_address', 2048)->default('')->comment('Юридический адрес ООО');
$table->string('ltd_poste_address', 2048)->default('')->comment('Почтовый адрес ООО');
$table->string('ltd_okved')->default('')->comment('ОКВЭД ООО');
$table->string('ltd_ceo_name', 2048)->default('')->comment('ФИО Генерального директора ООО');
$table->string('bank_account')->default('')->comment('Рассчетный счет');
$table->string('bank_correspondent_account')->default('')->comment('корреспондентский счет');
$table->string('bank_bik')->default('')->comment('БИК');
$table->string('bank_name', 2048)->default('')->comment('Название Банка');
$table->string('state')->default('published')->comment('published|appruved|cenceled');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('consultant_legal_entities');
}
};

View File

@@ -1,28 +0,0 @@
<?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('plans', function (Blueprint $table) {
$table->string('slug');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('plans', function (Blueprint $table) {
$table->dropColumn('slug');
});
}
};

View File

@@ -1,18 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class BlogPostSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//
}
}

View File

@@ -1,23 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call(PlanSeeder::class);
$this->call(UserSeeder::class);
$this->call(PlanAuthor::class);
$this->call(PlanCommentSeeder::class);
// $this->call(RecipeSeeder::class);
// \App\Models\User::factory(10)->create();
}
}

View File

@@ -1,23 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Diet;
use App\Models\User;
class DietsSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$diets = Diet::factory()->count(10)->create();
$diets->each(
fn ($diet) => $diet->author()->attach(User::inRandomOrder()->first())
);
}
}

View File

@@ -1,25 +0,0 @@
<?php
namespace Database\Seeders;
use App\Models\Plan;
use App\Models\User;
use Illuminate\Database\Seeder;
class PlanAuthor extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
if (User::count() > 0 && Plan::count() > 0) {
Plan::each(function ($plan) {
User::inRandomOrder()
->first()
->author_of_plans()
->attach($plan->id);
});
}
}
}

View File

@@ -1,37 +0,0 @@
<?php
namespace Database\Seeders;
use App\Models\Plan;
use App\Models\PlanComment;
use App\Models\User;
use Illuminate\Database\Seeder;
class PlanCommentSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
if (User::count() > 0 && Plan::count() > 0) {
$comments = PlanComment::factory()->count(5)->make();
$comments->each(function ($comment) {
$comment->author()->associate(
User::inRandomOrder()
->first()
->id
);
$comment->plan()->associate(
Plan::inRandomOrder()
->first()
->id
);
$comment->saveOrFail();
});
}
}
}

View File

@@ -1,17 +0,0 @@
<?php
namespace Database\Seeders;
use App\Models\Plan;
use Illuminate\Database\Seeder;
class PlanSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Plan::factory()->count(10)->create();
}
}

View File

@@ -1,59 +0,0 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use App\Models\UserDetailz;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class UserSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
array_map(function ($user) {
$user = User::factory($user)->create();
$userDetailz = UserDetailz::factory()->make();
$userDetailz->user()->associate($user);
$userDetailz->saveOrFail();
}, $this->getListUsers());
}
private function getListUsers(): array
{
$allUsersHash = Hash::make('1234567890');
return [
['id' => 3, 'name' => 'Анчоус Альф', 'email' => 'reshetnick.mike+user1@gmail.com', 'password' => $allUsersHash, 'is_consultant' => true],
['id' => 4, 'name' => 'Чена Сибаину', 'email' => 'reshetnik.n+user1@gmail.com', 'password' => $allUsersHash, 'is_consultant' => true],
['id' => 5, 'name' => 'Бруно Бармалей', 'email' => 'reshetnick.mike+user2@gmail.com', 'password' => $allUsersHash, 'is_consultant' => true],
['id' => 6, 'name' => 'Варенник Васаби', 'email' => 'reshetnick.mike+user3@gmail.com', 'password' => $allUsersHash, 'is_consultant' => true],
['id' => 7, 'name' => 'Денди Дуглас', 'email' => 'reshetnick.mike+user4@gmail.com', 'password' => $allUsersHash, 'is_consultant' => true],
['id' => 8, 'name' => 'Ник Радченков', 'email' => 'reshetnik.n+user2@gmail.com', 'password' => $allUsersHash],
['id' => 9, 'name' => 'Миса Кошка', 'email' => 'reshetnik.n+user3@gmail.com', 'password' => $allUsersHash],
['id' => 10, 'name' => 'Ерошка Есаул', 'email' => 'reshetnick.mike+user5@gmail.com', 'password' => $allUsersHash],
['id' => 11, 'name' => 'Жмурка Живчик', 'email' => 'reshetnick.mike+user6@gmail.com', 'password' => $allUsersHash],
['id' => 12, 'name' => 'Гошка Картошка', 'email' => 'reshetnik.n+user4@gmail.com', 'password' => $allUsersHash],
['id' => 13, 'name' => 'Зефир Забияка', 'email' => 'reshetnick.mike+user7@gmail.com', 'password' => $allUsersHash],
['id' => 14, 'name' => 'Антоша Одуван', 'email' => 'reshetnik.n+user5@gmail.com', 'password' => $allUsersHash],
['id' => 15, 'name' => 'Кусик Кукусик', 'email' => 'reshetnik.n+user6@gmail.com', 'password' => $allUsersHash],
['id' => 16, 'name' => 'Косик Кокосик', 'email' => 'reshetnik.n+user7@gmail.com', 'password' => $allUsersHash],
['id' => 17, 'name' => 'Хинкалька Вкусная', 'email' => 'reshetnik.n+user8@gmail.com', 'password' => $allUsersHash],
['id' => 18, 'name' => 'Импульс Йети', 'email' => 'reshetnick.mike+user8@gmail.com', 'password' => $allUsersHash],
['id' => 19, 'name' => 'Квики Кекс', 'email' => 'reshetnick.mike+user9@gmail.com', 'password' => $allUsersHash],
['id' => 20, 'name' => 'Чебурек Сочный', 'email' => 'reshetnik.n+user9@gmail.com', 'password' => $allUsersHash],
['id' => 21, 'name' => 'Клубника Дикая', 'email' => 'reshetnik.n+user10@gmail.com', 'password' => $allUsersHash],
['id' => 22, 'name' => 'Ляпис Лапша', 'email' => 'reshetnick.mike+user10@gmail.com', 'password' => $allUsersHash],
['id' => 23, 'name' => 'Друг Парадоксов', 'email' => 'reshetnick.mike+user11@gmail.com', 'password' => $allUsersHash],
];
}
}