feat: initialize general settings table with validation constraints and database seeder
This commit is contained in:
parent
703ceefddf
commit
f84173e8aa
@ -26,7 +26,7 @@ public function rules(): array
|
||||
$settingExists = GeneralSetting::exists();
|
||||
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'name' => ['required', 'string', 'max:50'],
|
||||
'description' => ['required', 'string'],
|
||||
'address' => ['required', 'string'],
|
||||
'phone' => ['required', 'string', 'max:20'],
|
||||
|
||||
@ -13,10 +13,10 @@ public function up(): void
|
||||
{
|
||||
Schema::create('general_settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->text('address')->nullable();
|
||||
$table->string('phone')->nullable();
|
||||
$table->string('name', 50);
|
||||
$table->text('description');
|
||||
$table->text('address');
|
||||
$table->string('phone', 20);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ public function run(): void
|
||||
ExpenseSeeder::class,
|
||||
PurchaseSeeder::class,
|
||||
OrderSeeder::class,
|
||||
GeneralSettingSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
22
database/seeders/GeneralSettingSeeder.php
Normal file
22
database/seeders/GeneralSettingSeeder.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\GeneralSetting;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class GeneralSettingSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
GeneralSetting::updateOrCreate([
|
||||
'name' => 'VN Grup',
|
||||
'description' => 'VN Grup adalah Toko Baju Daster Online yang menghadirkan koleksi baju daster berkualitas tinggi untuk wanita yang mengutamakan kenyamanan tanpa mengorbankan gaya. Kami menyediakan berbagai macam daster dengan desain yang beragam, mulai dari yang sederhana dan klasik hingga yang modern dan trendi, cocok untuk berbagai kebutuhan, baik di rumah maupun saat bersantai di luar.',
|
||||
'address' => 'Jl. Raya Pabuaran-Cipeunduy, Kec. Pabuaran, Kab. Subang, Jawa Barat',
|
||||
'phone' => '089679965828',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user