create accessor

This commit is contained in:
2025-11-26 16:13:55 +03:30
parent 8fba75a684
commit fb932937dc
5 changed files with 25 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ class GeneralManagerController extends Controller
$query = Harim::query()
->where('province_id', '=', auth()->user()->province_id)
->orderByRaw("
CASE state
CASE state_id
WHEN 4 THEN 1
WHEN 7 THEN 2
WHEN 15 THEN 3

View File

@@ -30,7 +30,7 @@ class HarimOfficeController extends Controller
$query = Harim::query()
->where('province_id', '=', auth()->user()->province_id)
->orderByRaw("
CASE state
CASE state_id
WHEN 2 THEN 1
WHEN 5 THEN 2
WHEN 13 THEN 3

View File

@@ -24,7 +24,7 @@ class ProvinceOfficeController extends Controller
$query = Harim::query()
->where('edareh_shahri_id', '=', $user->edarate_shahri_id)
->orderByRaw("
CASE state
CASE state_id
WHEN 1 THEN 1
ELSE 2
END

View File

@@ -28,7 +28,7 @@ class TechnicalDeputyController extends Controller
$query = Harim::query()
->where('province_id', '=', auth()->user()->province_id)
->orderByRaw("
CASE state
CASE state_id
WHEN 3 THEN 1
WHEN 6 THEN 2
WHEN 14 THEN 3

View File

@@ -69,4 +69,25 @@ class Harim extends Model
->latestOfMany()
->value('expert_description');
}
protected function forbiddenArea(): Attribute
{
return Attribute::make(
get: fn($value) => json_decode($value)
);
}
protected function finalArea(): Attribute
{
return Attribute::make(
get: fn($value) => json_decode($value)
);
}
protected function finalPlan(): Attribute
{
return Attribute::make(
get: fn($value) => json_decode($value)
);
}
}