87 lines
3.8 KiB
PHP
87 lines
3.8 KiB
PHP
<?php
|
||
|
||
namespace Database\Seeders;
|
||
|
||
use App\BusinessLocation;
|
||
use App\Restaurant\ResTable;
|
||
use App\TypesOfService;
|
||
use Illuminate\Database\Seeder;
|
||
|
||
class FastServiceSetupSeeder extends Seeder
|
||
{
|
||
/**
|
||
* انواع سرویس و میزهای ابزار برای کسبوکارهای خدمات فوری
|
||
* (پرینت سهبعدی، CNC، نصب نرمافزار، تعمیرات و...).
|
||
*/
|
||
public function run(): void
|
||
{
|
||
$business_id = 1;
|
||
$created_by = 1;
|
||
|
||
$location = BusinessLocation::where('business_id', $business_id)->first();
|
||
if (! $location) {
|
||
return;
|
||
}
|
||
|
||
$services = [
|
||
['name' => 'خدمات حضوری (در محل)', 'description' => 'مشتری حضوری مراجعه میکند و خدمت در محل انجام میشود'],
|
||
['name' => 'پرینت سهبعدی فوری', 'description' => 'چاپ قطعه سهبعدی با فایل مشتری و تحویل فوری'],
|
||
['name' => 'حکاکی CNC', 'description' => 'حکاکی و برش CNC روی فلز، پلکسی و مواد مشابه'],
|
||
['name' => 'نصب ویندوز', 'description' => 'نصب و راهاندازی ویندوز و درایورها برای مشتری'],
|
||
['name' => 'نصب نرمافزار', 'description' => 'نصب و پیکربندی نرمافزارهای کاربردی'],
|
||
['name' => 'تعمیر موبایل و تبلت', 'description' => 'تعمیرات سختافزاری و نرمافزاری موبایل'],
|
||
['name' => 'تعمیر لپتاپ و رایانه', 'description' => 'تعمیرات سختافزاری و ارتقای سیستم'],
|
||
['name' => 'تحویل فوری', 'description' => 'انجام و تحویل خدمت در همان روز مراجعه'],
|
||
];
|
||
|
||
$now = now();
|
||
|
||
foreach ($services as $service) {
|
||
$exists = TypesOfService::where('business_id', $business_id)
|
||
->where('name', $service['name'])
|
||
->exists();
|
||
|
||
if ($exists) {
|
||
continue;
|
||
}
|
||
|
||
TypesOfService::create([
|
||
'name' => $service['name'],
|
||
'description' => $service['description'],
|
||
'business_id' => $business_id,
|
||
'created_at' => $now,
|
||
'updated_at' => $now,
|
||
]);
|
||
}
|
||
|
||
$tool_benches = [
|
||
['name' => 'میز پرینت سهبعدی ۱', 'description' => 'پرینتر FDM / رزین'],
|
||
['name' => 'میز CNC حکاکی', 'description' => 'دستگاه حکاکی و برش CNC'],
|
||
['name' => 'میز نصب ویندوز و نرمافزار', 'description' => 'تعمیرات نرمافزاری و نصب سیستمعامل'],
|
||
['name' => 'میز تعمیرات موبایل', 'description' => 'تعمیرات گوشی و تبلت'],
|
||
['name' => 'میز تعمیرات لپتاپ', 'description' => 'تعمیرات و ارتقای لپتاپ'],
|
||
['name' => 'میز خدمت عمومی', 'description' => 'میز عمومی برای خدمات فوری متفرقه'],
|
||
];
|
||
|
||
foreach ($tool_benches as $bench) {
|
||
$exists = ResTable::where('business_id', $business_id)
|
||
->where('name', $bench['name'])
|
||
->exists();
|
||
|
||
if ($exists) {
|
||
continue;
|
||
}
|
||
|
||
ResTable::create([
|
||
'name' => $bench['name'],
|
||
'description' => $bench['description'],
|
||
'business_id' => $business_id,
|
||
'location_id' => $location->id,
|
||
'created_by' => $created_by,
|
||
'created_at' => $now,
|
||
'updated_at' => $now,
|
||
]);
|
||
}
|
||
}
|
||
}
|