wip
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
||||
use App\Nova\Resources\Order\Card\CardBalance\Actions\DownloadCardBalance;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use Dedoc\Scramble\Attributes\Group;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -114,62 +115,62 @@ class CardBalanceController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * UPDATE*
|
||||
// *
|
||||
// * ID ugradyp `route`-da update edip bilyan. Base App Enum-lardan peydalan. Panelkadan gor.
|
||||
// */
|
||||
// public function update(Request $request, CardTransaction $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(Request $request, CardBalance $order): JsonResponse
|
||||
{
|
||||
$data = $request->validate([
|
||||
/**
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['sometimes', Rule::in(array_keys(PassportRepo::values()))],
|
||||
|
||||
// /**
|
||||
// * @example 379514
|
||||
// */
|
||||
// 'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||
/**
|
||||
* @example 379514
|
||||
*/
|
||||
'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||
|
||||
// /**
|
||||
// * @example 9934612100000243
|
||||
// */
|
||||
// 'card_number' => ['sometimes', 'digits:16'],
|
||||
/**
|
||||
* @example 9934612100000243
|
||||
*/
|
||||
'card_number' => ['sometimes', 'digits:16'],
|
||||
|
||||
// /**
|
||||
// * @example 12
|
||||
// */
|
||||
// 'card_month' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
||||
/**
|
||||
* @example 12
|
||||
*/
|
||||
'card_month' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
||||
|
||||
// /**
|
||||
// * @example 2049
|
||||
// */
|
||||
// 'card_year' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
||||
// ]);
|
||||
/**
|
||||
* @example 2049
|
||||
*/
|
||||
'card_year' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
||||
]);
|
||||
|
||||
// Model::unguarded(function () use ($order, $data) {
|
||||
// $order->update($data);
|
||||
// });
|
||||
Model::unguarded(function () use ($order, $data) {
|
||||
$order->update($data);
|
||||
});
|
||||
|
||||
// return response()->json([
|
||||
// 'message' => __('Successfully updated'),
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * DELETE*
|
||||
// */
|
||||
// public function destroy(CardTransaction $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 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'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user