create Enum and seeder for BusinessType and payment_statuses #20
43
backend/app/Enums/BusinessTypeEnum.php
Normal file
43
backend/app/Enums/BusinessTypeEnum.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum BusinessTypeEnum: int
|
||||
{
|
||||
case MEDICAL = 1;
|
||||
case LEGAL = 2;
|
||||
case ENGINEERING = 3;
|
||||
case EDUCATION = 4;
|
||||
case CONSULTING = 5;
|
||||
case BEAUTY = 6;
|
||||
case TECHNICAL_SERVICES = 7;
|
||||
case FINANCIAL = 8;
|
||||
case REAL_ESTATE = 9;
|
||||
case RESTAURANT = 10;
|
||||
case SHOP = 11;
|
||||
case TRANSPORTATION = 12;
|
||||
case ART = 13;
|
||||
case SPORT = 14;
|
||||
case OTHER = 15;
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::MEDICAL => 'medical',
|
||||
self::LEGAL => 'legal',
|
||||
self::ENGINEERING => 'engineering',
|
||||
self::EDUCATION => 'education',
|
||||
self::CONSULTING => 'consulting',
|
||||
self::BEAUTY => 'beauty',
|
||||
self::TECHNICAL_SERVICES => 'technical_services',
|
||||
self::FINANCIAL => 'financial',
|
||||
self::REAL_ESTATE => 'real_estate',
|
||||
self::RESTAURANT => 'restaurant',
|
||||
self::SHOP => 'shop',
|
||||
self::TRANSPORTATION => 'transportation',
|
||||
self::ART => 'art',
|
||||
self::SPORT => 'sport',
|
||||
self::OTHER => 'other',
|
||||
};
|
||||
}
|
||||
}
|
||||
23
backend/app/Enums/PaymentStatusEnum.php
Normal file
23
backend/app/Enums/PaymentStatusEnum.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum PaymentStatusEnum:int
|
||||
{
|
||||
case Unpaid = 0;
|
||||
case Cancelled = 1;
|
||||
case Expired = 2;
|
||||
case Paid = 3;
|
||||
case Refunded = 4;
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Unpaid => 'unpaid',
|
||||
self::Cancelled => 'cancelled',
|
||||
self::Expired => 'expired',
|
||||
self::Paid => 'paid',
|
||||
self::Refunded => 'refunded',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BusinessTypeSeeder extends Seeder
|
||||
{
|
||||
@@ -12,6 +13,22 @@ class BusinessTypeSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
DB::table('business_types')->insert([
|
||||
['id' => 1, 'name' => 'medical', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 2, 'name' => 'legal', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 3, 'name' => 'engineering', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 4, 'name' => 'education', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 5, 'name' => 'consulting', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 6, 'name' => 'beauty', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 7, 'name' => 'technical_services', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 8, 'name' => 'financial', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 9, 'name' => 'real_estate', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 10, 'name' => 'restaurant', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 11, 'name' => 'shop', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 12, 'name' => 'transportation', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 13, 'name' => 'art', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 14, 'name' => 'sport', 'created_at' => now(), 'updated_at' => now()],
|
||||
['id' => 15, 'name' => 'other', 'created_at' => now(), 'updated_at' => now()],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PaymentStatusSeeder extends Seeder
|
||||
{
|
||||
@@ -12,6 +13,12 @@ class PaymentStatusSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
DB::table('payment_statuses')->insert([
|
||||
['id' => 0, 'name' => 'unpaid', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 1, 'name' => 'cancelled', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 2, 'name' => 'expired', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 3, 'name' => 'paid', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 4, 'name' => 'refunded', 'created_at' => now(), 'updated_at' => now(),],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user