1
0
mirror of https://github.com/robonen/metr.git synced 2026-03-20 02:44:42 +00:00

All models

This commit is contained in:
2022-05-26 11:20:47 +07:00
parent 3146fb1fd0
commit c4f98fdb58
14 changed files with 248 additions and 26 deletions

View File

@@ -15,11 +15,13 @@ return new class extends Migration
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('first_name');
$table->string('last_name');
$table->string('middle_name')->nullable();
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('phone')->unique()->nullable();
$table->string('photo')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}

View File

@@ -0,0 +1,39 @@
<?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('offers', function (Blueprint $table) {
$table->id();
$table->foreignId('owner_id');
$table->string('name');
$table->enum('type', ['studio']);
$table->decimal('price');
$table->unsignedSmallInteger('rooms');
$table->string('yandex_mark')->nullable();
$table->text('text');
$table->boolean('is_group');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('offers');
}
};

View File

@@ -13,13 +13,10 @@ return new class extends Migration
*/
public function up()
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
Schema::create('offer_photos', 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->foreignId('offer_id');
$table->string('file');
$table->timestamps();
});
}
@@ -31,6 +28,6 @@ return new class extends Migration
*/
public function down()
{
Schema::dropIfExists('personal_access_tokens');
Schema::dropIfExists('offer_photos');
}
};

View File

@@ -0,0 +1,35 @@
<?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('reviews', function (Blueprint $table) {
$table->id();
$table->foreignId('offer_id');
$table->foreignId('user_id');
$table->text('comment');
$table->unsignedFloat('rating');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('reviews');
}
};

View File

@@ -0,0 +1,37 @@
<?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('orders', function (Blueprint $table) {
$table->id();
$table->foreignId('offer_id');
$table->foreignId('user_id');
$table->date('start_date');
$table->date('end_date');
$table->decimal('price');
$table->decimal('discount');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('orders');
}
};