WIP
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?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('order_shipping_methods', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->json('name');
|
||||
$table->string('slug')->unique();
|
||||
$table->json('description')->nullable();
|
||||
$table->string('price')->default(0);
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('order_shipping_methods');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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('orders', function (Blueprint $table) {
|
||||
$table->foreignId('shipping_method_id')->nullable()->constrained('order_shipping_methods')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->dropForeign(['shipping_method_id']);
|
||||
$table->dropColumn('shipping_method_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class BrandTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Ecommerce\Channel\Channel;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class ChannelTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace Database\Seeders;
|
||||
|
||||
use App\Models\Legal\LegalPage;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class LegalPageTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
49
database/seeders/OrderShippingMethodSeeder.php
Normal file
49
database/seeders/OrderShippingMethodSeeder.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Ecommerce\Product\Order\Shipping\OrderShippingMethod;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class OrderShippingMethodSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$methods = [
|
||||
[
|
||||
'slug' => 'standart',
|
||||
'name' => ['en' => 'Standart', 'tk' => 'Standart', 'ru' => 'Стандарт'],
|
||||
'price' => 20,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'express',
|
||||
'name' => ['en' => 'Express', 'tk' => 'Express', 'ru' => 'Экспресс'],
|
||||
'price' => 30,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'self_pickup',
|
||||
'name' => ['en' => 'Self Pickup', 'tk' => 'Öz-özüňi almak', 'ru' => 'Самовывоз'],
|
||||
'price' => 0,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'region',
|
||||
'name' => ['en' => 'Region', 'tk' => 'Welaýat', 'ru' => 'Регион'],
|
||||
'price' => 40,
|
||||
'is_active' => true,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($methods as $method) {
|
||||
OrderShippingMethod::firstOrCreate(
|
||||
['slug' => $method['slug']],
|
||||
$method
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class ProvinceTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ class UserTableSeeder extends Seeder
|
||||
'last_name' => 'Admin',
|
||||
'email' => 'admin@smartelektronika.com',
|
||||
'password' => bcrypt('PuteraSeroja'),
|
||||
]
|
||||
],
|
||||
])->each(function ($data) {
|
||||
$user = User::create($data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user