Added place edit function

This commit is contained in:
amikhaylov
2026-05-19 17:53:53 +03:00
parent 24fe78ce52
commit 08cb7ef9c0
5 changed files with 224 additions and 16 deletions
@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
Schema::create('places', function (Blueprint $create) {
$create->id();
// Основные поля
$create->string('name', 512)->nullable();
$create->string('address', 512)->nullable();
$create->string('phone', 128)->nullable();
$create->string('gps', 512)->nullable();
$create->string('url', 255)->nullable();
$create->text('description')->nullable();
// Даты (Laravel по умолчанию использует timestamp,
// но здесь приведены к вашему формату datetime)
$create->datetime('created_at')->useCurrent();
$create->datetime('updated_at')->useCurrent()->useCurrentOnUpdate();
$create->softDeletes(); // Это поле deleted_at
// Индексы с ограничением длины (как в вашем SQL)
$create->index([DB::raw('name(255)')], 'idx_name');
$create->index([DB::raw('gps(255)')], 'idx_gps');
});
}
public function down(): void
{
Schema::dropIfExists('places');
}
};