mirror of
https://github.com/robonen/metr.git
synced 2026-03-20 02:44:42 +00:00
User authentication
This commit is contained in:
@@ -15,8 +15,8 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('first_name');
|
||||
$table->string('last_name');
|
||||
$table->string('first_name')->nullable();
|
||||
$table->string('last_name')->nullable();
|
||||
$table->string('middle_name')->nullable();
|
||||
$table->string('email')->unique();
|
||||
$table->string('phone')->unique()->nullable();
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePersonalAccessTokensTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->morphs('tokenable');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
}
|
||||
@@ -16,16 +16,22 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('offers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('owner_id');
|
||||
$table->string('name');
|
||||
$table->enum('type', OrderTypesEnum::values());
|
||||
$table->decimal('price');
|
||||
$table->unsignedSmallInteger('rooms');
|
||||
$table->decimal('space');
|
||||
$table->string('yandex_mark')->nullable();
|
||||
$table->string('location');
|
||||
$table->text('description');
|
||||
$table->boolean('is_group');
|
||||
$table->timestamps();
|
||||
|
||||
$table
|
||||
->foreignId('user_id')
|
||||
->constrained()
|
||||
->onDelete('set null')
|
||||
->onUpdate('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,13 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('offer_photos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('offer_id');
|
||||
$table->string('file');
|
||||
$table->timestamps();
|
||||
|
||||
$table
|
||||
->foreignId('offer_id')
|
||||
->constrained()
|
||||
->onUpdate('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,17 @@ return new class extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('reviews', function (Blueprint $table) {
|
||||
Schema::create('feedback', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('offer_id');
|
||||
$table->foreignId('user_id');
|
||||
$table->text('comment');
|
||||
$table->unsignedFloat('rating');
|
||||
$table->timestamps();
|
||||
|
||||
$table
|
||||
->foreignId('user_id')
|
||||
->constrained()
|
||||
->onDelete('cascade')
|
||||
->onUpdate('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -30,6 +34,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('reviews');
|
||||
Schema::dropIfExists('feedback');
|
||||
}
|
||||
};
|
||||
@@ -15,13 +15,21 @@ return new class extends Migration
|
||||
{
|
||||
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();
|
||||
|
||||
$table
|
||||
->foreignId('offer_id')
|
||||
->constrained()
|
||||
->onDelete('set null')
|
||||
->onUpdate('cascade');
|
||||
|
||||
$table
|
||||
->foreignId('user_id')
|
||||
->constrained()
|
||||
->onDelete('set null')
|
||||
->onUpdate('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user