wip
This commit is contained in:
@@ -4,10 +4,12 @@ namespace App\Http\Controllers\Api\CardPin;
|
|||||||
|
|
||||||
use App\Http\Controllers\Api\CardPin\Requests\CardPinIndexResource;
|
use App\Http\Controllers\Api\CardPin\Requests\CardPinIndexResource;
|
||||||
use App\Http\Controllers\Api\CardPin\Requests\CardPinStoreRequest;
|
use App\Http\Controllers\Api\CardPin\Requests\CardPinStoreRequest;
|
||||||
|
use App\Http\Controllers\Api\CardPin\Requests\CardPinUpdateRequest;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Order\Card\CardPin\CardPin;
|
use App\Models\Order\Card\CardPin\CardPin;
|
||||||
use App\Repos\Order\OrderRepo;
|
use App\Repos\Order\OrderRepo;
|
||||||
use Dedoc\Scramble\Attributes\Group;
|
use Dedoc\Scramble\Attributes\Group;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
@@ -81,62 +83,37 @@ class CardPinController extends Controller
|
|||||||
return response()->json(new CardPinIndexResource($order));
|
return response()->json(new CardPinIndexResource($order));
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * UPDATE*
|
* UPDATE*
|
||||||
// *
|
*
|
||||||
// * ID ugradyp `route`-da update edip bilyan. Base App Enum-lardan peydalan. Panelkadan gor.
|
* ID ugradyp `route`-da update edip bilyan. Base App Enum-lardan peydalan. Panelkadan gor.
|
||||||
// */
|
*/
|
||||||
// public function update(Request $request, CardBalance $order): JsonResponse
|
public function update(CardPinUpdateRequest $request, CardPin $order): JsonResponse
|
||||||
// {
|
{
|
||||||
// $data = $request->validate([
|
$data = array_merge($request->all(), $this->uploadedFiles($request));
|
||||||
// /**
|
|
||||||
// * @example I-AS
|
|
||||||
// */
|
|
||||||
// 'passport_serie' => ['sometimes', Rule::in(array_keys(PassportRepo::values()))],
|
|
||||||
|
|
||||||
// /**
|
Model::unguarded(function () use ($order, $data) {
|
||||||
// * @example 379514
|
$order->update($data);
|
||||||
// */
|
});
|
||||||
// 'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
|
||||||
|
|
||||||
// /**
|
return response()->json([
|
||||||
// * @example 9934612100000243
|
'message' => __('Successfully updated'),
|
||||||
// */
|
]);
|
||||||
// 'card_number' => ['sometimes', 'digits:16'],
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * @example 12
|
* DELETE*
|
||||||
// */
|
*/
|
||||||
// 'card_month' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
public function destroy(CardPin $order): JsonResponse
|
||||||
|
{
|
||||||
|
if ($order->user_id != auth()->id()) {
|
||||||
|
return response()->json(status: 403);
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
$order->delete();
|
||||||
// * @example 2049
|
|
||||||
// */
|
|
||||||
// 'card_year' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
// Model::unguarded(function () use ($order, $data) {
|
return response()->json([
|
||||||
// $order->update($data);
|
'message' => __('Successfully deleted'),
|
||||||
// });
|
]);
|
||||||
|
}
|
||||||
// return response()->json([
|
|
||||||
// 'message' => __('Successfully updated'),
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * DELETE*
|
|
||||||
// */
|
|
||||||
// public function destroy(CardBalance $order): JsonResponse
|
|
||||||
// {
|
|
||||||
// if ($order->user_id != auth()->id()) {
|
|
||||||
// return response()->json(status: 403);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $order->delete();
|
|
||||||
|
|
||||||
// return response()->json([
|
|
||||||
// 'message' => __('Successfully deleted'),
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api\CardPin\Requests;
|
||||||
|
|
||||||
|
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||||
|
use App\Repos\System\Settings\Location\RegionRepo;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
class CardPinUpdateRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<int, string>|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
/**
|
||||||
|
* Card type id (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||||
|
*/
|
||||||
|
'card_type_id' => ['sometimes', 'integer', Rule::exists('card_types', 'id')],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||||
|
*
|
||||||
|
* @example ag
|
||||||
|
*/
|
||||||
|
'region' => ['sometimes', 'string', Rule::in(array_keys(RegionRepo::values()))],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Branch id (https://online.tbbank.gov.tm/api/branches)
|
||||||
|
*/
|
||||||
|
'branch_id' => ['sometimes', 'integer', Rule::exists('branches', 'id')],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Customer name
|
||||||
|
*
|
||||||
|
* @example Mahmyt
|
||||||
|
*/
|
||||||
|
'customer_name' => ['sometimes', 'string', 'max:255'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Customer surname
|
||||||
|
*
|
||||||
|
* @example Allaberdiyev
|
||||||
|
*/
|
||||||
|
'customer_surname' => ['sometimes', 'string', 'max:255'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Customer patronic name
|
||||||
|
*
|
||||||
|
* @example Öwezowiç
|
||||||
|
*/
|
||||||
|
'customer_patronic_name' => ['nullable', 'string', 'max:255'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date of birth
|
||||||
|
*
|
||||||
|
* @example 10.10.2000
|
||||||
|
*/
|
||||||
|
'born_at' => ['sometimes', 'before_or_equal:today'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Passport serie
|
||||||
|
*
|
||||||
|
* @example I-AS
|
||||||
|
*/
|
||||||
|
'passport_serie' => ['sometimes', 'string', Rule::in(PassportRepo::values())],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Passport number
|
||||||
|
*
|
||||||
|
* @example 100999
|
||||||
|
*/
|
||||||
|
'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card number
|
||||||
|
*
|
||||||
|
* @example 9934 2312 2342 0249
|
||||||
|
*/
|
||||||
|
'card_number' => ['sometimes', 'string'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Phone number
|
||||||
|
*
|
||||||
|
* @example 65999990
|
||||||
|
*/
|
||||||
|
'phone' => ['sometimes', 'integer', 'between:61000000, 71999999'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Passport (sahypa 1)
|
||||||
|
*/
|
||||||
|
'passport_one' => ['sometimes', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pasport (2-3-nji sahypa)
|
||||||
|
*/
|
||||||
|
'passport_two' => ['sometimes', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pasport (8-9 sahypa)
|
||||||
|
*/
|
||||||
|
'passport_three' => ['sometimes', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pasport (32-nji sahypa)
|
||||||
|
*/
|
||||||
|
'passport_four' => ['sometimes', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user