Merge branch 'feature/InquiryProcess' into 'develop'
rewrite proses harim See merge request witelgroup/rms_v2!145
This commit is contained in:
25
app/Enums/HarimStates.php
Normal file
25
app/Enums/HarimStates.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum HarimStates: int
|
||||
{
|
||||
case Baresi_Edare_Shahrestan = 1;
|
||||
case Baresi_Imeni_Rah_Tavasot_Daftar_Harim = 2;
|
||||
case Baresi_Imeni_Rah_Tavasot_Moaven = 3;
|
||||
case Baresi_Imeni_Rah_Tavasot_Modir_Kol = 4;
|
||||
case Rad_Be_Dalil_Imeni_Rah = 5;
|
||||
|
||||
public static function name(int $state): string
|
||||
{
|
||||
$mapArray = [
|
||||
1 => "بررسی ادارات شهرستان",
|
||||
2 => "بررسی ایمنی راه توسط ادارات حریم",
|
||||
3 => "بررسی ایمنی راه توسط معاون ",
|
||||
4 => "بررسی ایمنی راه توسط مدیر کل",
|
||||
5 => "رد درخواست به دلیل ایمنی راه",
|
||||
];
|
||||
|
||||
return $mapArray[$state];
|
||||
}
|
||||
}
|
||||
13
app/Models/Harim.php
Normal file
13
app/Models/Harim.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Harim extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $guarded = [];
|
||||
protected $table = 'harim';
|
||||
}
|
||||
13
app/Models/HarimAction.php
Normal file
13
app/Models/HarimAction.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HarimAction extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $guarded = [];
|
||||
|
||||
}
|
||||
12
app/Models/HarimHistory.php
Normal file
12
app/Models/HarimHistory.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HarimHistory extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $guarded = [];
|
||||
}
|
||||
12
app/Models/HarimState.php
Normal file
12
app/Models/HarimState.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HarimState extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $guarded = [];
|
||||
}
|
||||
23
database/factories/HarimActionFactory.php
Normal file
23
database/factories/HarimActionFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\HarimAction>
|
||||
*/
|
||||
class HarimActionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->name(),
|
||||
];
|
||||
}
|
||||
}
|
||||
55
database/factories/HarimFactory.php
Normal file
55
database/factories/HarimFactory.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\City;
|
||||
use App\Models\EdarateShahri;
|
||||
use App\Models\HarimState;
|
||||
use App\Models\Province;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Harim>
|
||||
*/
|
||||
class HarimFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'state_id' => $this->faker->numberBetween(1,5),
|
||||
'state_name' => function (array $attributes) {
|
||||
return HarimState::query()->find($attributes['state_id'])->name;
|
||||
},
|
||||
'first_name' => $this->faker->firstName(),
|
||||
'last_name' => $this->faker->lastName(),
|
||||
'phone_number' => $this->faker->numerify('09#########'),
|
||||
'request_number' => $this->faker->numerify(),
|
||||
'request_date' => $this->faker->date(),
|
||||
'province_id' => Province::factory(),
|
||||
'province_name' => function (array $attributes) {
|
||||
return Province::query()->find($attributes['province_id'])->name;
|
||||
},
|
||||
'city_id' => City::factory(),
|
||||
'city_name' => function (array $attributes) {
|
||||
return City::query()->find($attributes['city_id'])->name;
|
||||
},
|
||||
'edareh_shahri_id' => EdarateShahri::factory(),
|
||||
'county' => $this->faker->citySuffix,
|
||||
'division' => $this->faker->word,
|
||||
'village' => $this->faker->name,
|
||||
'grand_area' => $this->faker->numberBetween(1,100),
|
||||
'plan_area' => $this->faker->numberBetween(1,100),
|
||||
'requested_organization' => $this->faker->name,
|
||||
'plan_group' => $this->faker->name,
|
||||
'plan_title' => $this->faker->title,
|
||||
'address' => $this->faker->address,
|
||||
'file' => $this->faker->file,
|
||||
'polygon' => $this->faker->numerify(),
|
||||
];
|
||||
}
|
||||
}
|
||||
41
database/factories/HarimHistoryFactory.php
Normal file
41
database/factories/HarimHistoryFactory.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use App\Models\HarimAction;
|
||||
use App\Models\HarimState;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\HarimHistory>
|
||||
*/
|
||||
class HarimHistoryFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'previous_state_id' => HarimState::factory(),
|
||||
'previous_state_name' => function (array $attributes) {
|
||||
return HarimStates::query()->find($attributes['state_id'])->name;
|
||||
},
|
||||
'current_state_id' => HarimState::factory(),
|
||||
'current_state_name' => function (array $attributes) {
|
||||
return HarimState::query()->find($attributes['state_id'])->name;
|
||||
},
|
||||
'action_id' => HarimAction::factory(),
|
||||
'action_name' => function (array $attributes) {
|
||||
return HarimAction::query()->find($attributes['state_id'])->name;
|
||||
},
|
||||
'expert_id' => User::factory(),
|
||||
'expert_description' => $this->fake()->text,
|
||||
'previous_data' => json_encode(['fake']),
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/HarimStateFactory.php
Normal file
23
database/factories/HarimStateFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\HarimState>
|
||||
*/
|
||||
class HarimStateFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->name(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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('harim_states', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('harim_states');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?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('harims', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('state_id')->constrained('harim_states');
|
||||
$table->string('state_name');
|
||||
$table->string('first_name');
|
||||
$table->string('last_name');
|
||||
$table->string('phone_number');
|
||||
$table->string('request_number');
|
||||
$table->date('request_date');
|
||||
$table->unsignedTinyInteger('province_id');
|
||||
$table->foreign('province_id')->references('id')->on('provinces');
|
||||
$table->string('province_name');
|
||||
$table->unsignedSmallInteger('city_id');
|
||||
$table->foreign('city_id')->references('id')->on('cities');
|
||||
$table->string('city_name');
|
||||
$table->unsignedBigInteger('edareh_shahri_id');
|
||||
$table->foreign('edareh_shahri_id')->references('id')->on('edarate_shahri');
|
||||
$table->string('county');
|
||||
$table->string('division');
|
||||
$table->string('village');
|
||||
$table->integer('grand_area');
|
||||
$table->integer('plan_area');
|
||||
$table->string('requested_organization');
|
||||
$table->string('plan_group');
|
||||
$table->string('plan_title');
|
||||
$table->string('address');
|
||||
$table->string('file');
|
||||
$table->polygon('polygon');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('harims');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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('harim_actions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('harim_actions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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('harim_histories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('previous_state_id')->constrained('harim_states');
|
||||
$table->string('previous_state_name');
|
||||
$table->foreignId('current_state_id')->constrained('harim_states');
|
||||
$table->string('current_state_name');
|
||||
$table->foreignId('action_id')->constrained('harim_actions');
|
||||
$table->string('action_name');
|
||||
$table->unsignedInteger('expert_id');
|
||||
$table->foreign('expert_id')->references('id')->on('users');
|
||||
$table->string('expert_description');
|
||||
$table->json('previous_data');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('harim_histories');
|
||||
}
|
||||
};
|
||||
@@ -12,12 +12,12 @@ class DatabaseSeeder extends Seeder
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
ProvinceSeeder::class;
|
||||
CitySeeder::class;
|
||||
EdarateShahriSeeder::class;
|
||||
InfoItemSeeder::class;
|
||||
LogListSeeder::class;
|
||||
PermissionSeeder::class;
|
||||
ProvinceSeeder::class,
|
||||
CitySeeder::class,
|
||||
EdarateShahriSeeder::class,
|
||||
InfoItemSeeder::class,
|
||||
LogListSeeder::class,
|
||||
PermissionSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
24
database/seeders/HarimActionSeeder.php
Normal file
24
database/seeders/HarimActionSeeder.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class HarimActionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('harim_actions')->insert([
|
||||
['id' => 1, 'name' => 'feedback', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 1, 'name' => 'yes', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 2, 'name' => 'no', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 3, 'name' => 'confirm', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 4, 'name' => 'refer', 'created_at' => now(), 'updated_at' => now(),],
|
||||
]);
|
||||
}
|
||||
}
|
||||
20
database/seeders/HarimHistorySeeder.php
Normal file
20
database/seeders/HarimHistorySeeder.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\HarimHistory;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class HarimHistorySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
HarimHistory::factory()
|
||||
->count(5)
|
||||
->create();
|
||||
}
|
||||
}
|
||||
21
database/seeders/HarimSeeder.php
Normal file
21
database/seeders/HarimSeeder.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class HarimSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
Harim::factory()
|
||||
->count(5)
|
||||
->create();
|
||||
|
||||
}
|
||||
}
|
||||
24
database/seeders/HarimStateSeeder.php
Normal file
24
database/seeders/HarimStateSeeder.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class HarimStateSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('harim_states')->insert([
|
||||
['id' => 1, 'name' => 'در انتظار بررسی اداره شهرستان', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 2, 'name' => 'در انتظار بررسی ایمنی راه توسط دفتر حریم', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 3, 'name' => 'در انتظار بررسی ایمنی راه توسط معاون', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 4, 'name' => 'در انتظار بررسی ایمنی راه توسط مدیر کل', 'created_at' => now(), 'updated_at' => now(),],
|
||||
['id' => 5, 'name' => 'رد به دلیل ایمنی راه', 'created_at' => now(), 'updated_at' => now(),],
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user