#P1728
RESOURCE /v2/accommodation/rules
Accommodation Rules CRUD
این کنترلر وظیفه مدیریت قوانین اقامتگاه (Accommodation Rules) را بر عهده دارد (مانند: قوانین کنسلی، ساعت ورود/خروج، ممنوعیت حیوانات خانگی و ...).
دادهها مستقیماً در جدول accommodation_rules ذخیره میشوند و برای تمام عملیات دیتابیس از Query Builder استفاده شده است.
List All Rules
URL:
/v2/accommodation/rulesMethod: GET
Controller: RuleController@index
دریافت لیست کامل قوانین ثبت شده بدون فیلترینگ یا صفحهبندی.
Response Example
{
"status": true,
"time": 1715000000,
"data": [
{
"id": 1,
"accommodation": 105,
"title_en": "No Smoking",
"title_fa": "استعمال دخانیات ممنوع",
"description": "Smoking is strictly prohibited inside the rooms.",
"status": 1
}
]
}
Create Rule
URL:
/v2/accommodation/rulesMethod: POST
Controller: RuleController@store
Body Parameters
| Parameter | Type | Description |
|---|---|---|
| accommodation | integer | شناسه اقامتگاه مرتبط (Relation Key). |
| title_en | string | عنوان انگلیسی قانون. |
| title_fa | string | عنوان فارسی قانون. |
| description | string | توضیحات کامل قانون. |
| status | integer | وضعیت (1: فعال، 0: غیرفعال). |
Show Rule Details
URL:
/v2/accommodation/rules/{id}Method: GET
Controller: RuleController@show
نمایش جزئیات یک قانون خاص بر اساس شناسه.
Update Rule
URL:
/v2/accommodation/rules/{id}Method: PUT/PATCH
Controller: RuleController@update
Body Parameters
| Parameter | Type | Description |
|---|---|---|
| accommodation | integer | شناسه اقامتگاه. (قابل ویرایش) |
| title_en | string | عنوان انگلیسی. |
| title_fa | string | عنوان فارسی. |
| description | string | توضیحات. |
| status | integer | وضعیت. |
تفاوت با سایر کنترلرها: در این کنترلر، فیلد رابطه (
accommodation) نیز در متد Update وجود دارد و قابل تغییر است.Delete Rule
URL:
/v2/accommodation/rules/{id}Method: DELETE
Controller: RuleController@destroy
حذف فیزیکی رکورد از جدول accommodation_rules.