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\CardPinStoreRequest;
|
||||
use App\Http\Controllers\Api\CardPin\Requests\CardPinUpdateRequest;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Order\Card\CardPin\CardPin;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use Dedoc\Scramble\Attributes\Group;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -81,62 +83,37 @@ class CardPinController extends Controller
|
||||
return response()->json(new CardPinIndexResource($order));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * UPDATE*
|
||||
// *
|
||||
// * ID ugradyp `route`-da update edip bilyan. Base App Enum-lardan peydalan. Panelkadan gor.
|
||||
// */
|
||||
// public function update(Request $request, CardBalance $order): JsonResponse
|
||||
// {
|
||||
// $data = $request->validate([
|
||||
// /**
|
||||
// * @example I-AS
|
||||
// */
|
||||
// 'passport_serie' => ['sometimes', Rule::in(array_keys(PassportRepo::values()))],
|
||||
/**
|
||||
* UPDATE*
|
||||
*
|
||||
* ID ugradyp `route`-da update edip bilyan. Base App Enum-lardan peydalan. Panelkadan gor.
|
||||
*/
|
||||
public function update(CardPinUpdateRequest $request, CardPin $order): JsonResponse
|
||||
{
|
||||
$data = array_merge($request->all(), $this->uploadedFiles($request));
|
||||
|
||||
// /**
|
||||
// * @example 379514
|
||||
// */
|
||||
// 'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||
Model::unguarded(function () use ($order, $data) {
|
||||
$order->update($data);
|
||||
});
|
||||
|
||||
// /**
|
||||
// * @example 9934612100000243
|
||||
// */
|
||||
// 'card_number' => ['sometimes', 'digits:16'],
|
||||
return response()->json([
|
||||
'message' => __('Successfully updated'),
|
||||
]);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @example 12
|
||||
// */
|
||||
// 'card_month' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
||||
/**
|
||||
* DELETE*
|
||||
*/
|
||||
public function destroy(CardPin $order): JsonResponse
|
||||
{
|
||||
if ($order->user_id != auth()->id()) {
|
||||
return response()->json(status: 403);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @example 2049
|
||||
// */
|
||||
// 'card_year' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
||||
// ]);
|
||||
$order->delete();
|
||||
|
||||
// Model::unguarded(function () use ($order, $data) {
|
||||
// $order->update($data);
|
||||
// });
|
||||
|
||||
// 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'),
|
||||
// ]);
|
||||
// }
|
||||
return response()->json([
|
||||
'message' => __('Successfully deleted'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user